Reply
Thread Tools
janszoon's Avatar
Posts: 224 | Thanked: 80 times | Joined on Nov 2009
#21
sounds cool. I always used to think it would have been cool to switch to '' profile based on Bluetooth or WIFI connection. i.e when detected at my work computer, silent profile activate automatically, when home computer detected, 'general' profile activated....but doing it to times would also be a good/better option.

something that triggers due to 'actual activity' i'e Bluetooth found, wifi detected etc etc would ensure you could be flexible with your time.

*subscribed*
__________________
My N900 Photo Gallery and Slideshow
 
Posts: 24 | Thanked: 8 times | Joined on Dec 2009
#22
I've put together the tips in this thread and some others from here (with thanks to ruskie) and I came up with this not-exactly-easy guide to setup timed profiles.

I've made two scripts, profile_general.sh and profile_silent.sh, to set the profile to general or silent, then setup fcron to run these scripts at specific times.

And this is how I did it:
cd /home/user
mkdir Scripts
cd Scripts
create a file named "profile_general.sh", containing:
#!/bin/sh
dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"general"

and "profile_silent.sh", containing
#!/bin/sh
dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"


cd /home/user/MyDocs/.documents
wget https://repo.codemages.net/opt/fcron..._armel_opt.deb --no-check-certificate
dpkg -i fcron_3.0.1-2_armel_opt.deb

sudo gainroot

I haven't tested it, but I think you can create a fcron user with:
useradd fcron
if that doesn't work, then install adduser:
apt-get install adduser --allow-unauthenticated
adduser fcron

setup fcrontab:
chown fcron:fcron /etc/fcron.*
chown -R fcron:fcron /var/spool/fcron

EDIT --- editing rcS-late is generally a bad idea and should be avoided. The script will break across upgrades, for instance. See instead the setup of the startup script here: http://wiki.maemo.org/Fcron#Installation
if you still want to edit /etc/event.d/rcS-late, after "initctl emit MOUNTS_OK", add:
/etc/init.d/fcron start
--- from here on everything should be ok.

and now, the cron jobs:
export EDITOR=vim
fcrontab -e
i have entered the following jobs:
0 8 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
0 9 * * 1-5 run-standalone.sh /home/user/Scripts/profile_silent.sh
30 12 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
30 13 * * 1-5 run-standalone.sh /home/user/Scripts/profile_silent.sh
0 18 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
59 23 * * 0-4 run-standalone.sh /home/user/Scripts/profile_silent.sh
0 11 * * 6,0 run-standalone.sh /home/user/Scripts/profile_general.sh
0 2 * * 6,0 run-standalone.sh /home/user/Scripts/profile_silent.sh

back to the shell, type:
/etc/init.d/fcron start
it is set up to be silent from 8:00 to 18:00 (with a pause from 12:30 to 13:30) and from 00:00 to 8:00, except on saturday and sunday when it will be silent from 2:00 to 11:00.

The "export EDITOR=vim" is needed because fcrontab -e will look for vi in /scratchbox/tools/bin/vi and I don't have it there.
*maybe* you can use an editor other than vim. maybe also one with a GUI.

Last edited by simoneb; 2010-05-31 at 20:53. Reason: not very smart to edit rcS-late. added pointer to wiki
 
Posts: 398 | Thanked: 301 times | Joined on Sep 2007 @ Texas
#23
You sir, are my hero. I was threatening to write an application last night when I turned my phone off before bed.

Here are some additional calls others may find handy. Someone adding bluetooth would make this complete I think.

Turn off cellular:
dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:false

Turn on cellular:
dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:true

Turn off WiFi:
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true

Flight mode:
dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"flight"

Normal mode:
dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"normal"

Frank

Last edited by Frank Banul; 2010-02-03 at 23:25.
 

The Following 2 Users Say Thank You to Frank Banul For This Useful Post:
Posts: 313 | Thanked: 247 times | Joined on Jan 2010 @ USA
#24
There is already an app for this - http://maemo.org/packages/view/ses/
 
Posts: 8 | Thanked: 3 times | Joined on Nov 2009 @ Finland
#25
Originally Posted by dsawhney View Post
There is already an app for this - http://maemo.org/packages/view/ses/
Simon here has even written a blog post on how to use it: http://knownokia.ca/2010/02/02/autom...-for-the-n900/.
 
Posts: 156 | Thanked: 90 times | Joined on Jan 2010
#26
But ses has LOTS of bugs. First its portrait UI. It's a bug not a feature, because it's not consistent with current Maemo and doesn't work properly. For example when you tap the dashboard button too much is highlighted and so on. Also sometimes when you add an entry it displays wrong hour in the list. For example I added an entry with 8.00 and ses added it to list as 7.26. And it doesn't even uninstall properly. For me it was still switching profiles after the uninstall so I had to delete it manually.

I'll use fcron as it also doesn't limit me. I can schedule just about anything...

Last edited by rooted; 2010-02-04 at 17:49.
 
Posts: 23 | Thanked: 8 times | Joined on Nov 2009
#27
The cron solution works well!
 
Posts: 156 | Thanked: 90 times | Joined on Jan 2010
#28
I'm using fcron too and I have a question. fcron needs user "fcron" to be run. However, when I added fcron user with "adduser fcron" its home directory was created. My question is if I can safely remove /home/fcron/ or is it needed by fcron/Maemo?
 
Posts: 543 | Thanked: 181 times | Joined on Aug 2009 @ Universe,LocalCluster.MilkyWay.Sol.Earth.Europe.Slovenia.Ljubljana
#29
You should be safe to remove it. Or point it to /var/run/fcron that's where it usually goes.
__________________
For any repos or anything else I might have working on my N900 see:
http://wiki.maemo.org/User:Ruskie
A quick list of what I have in the repos
zsh|xmms2|fcron|gtar|gcoreutils
 
Posts: 156 | Thanked: 90 times | Joined on Jan 2010
#30
I have another question. Why did you use "adduser", which had to be downloaded and installed instead of already-present "useradd"?
 

The Following User Says Thank You to rooted For This Useful Post:
Reply

Tags
automation, crontab, request


 
Forum Jump


All times are GMT. The time now is 12:08.