Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    [Request] Custom profile depending of the time of day

    Reply
    Page 3 of 4 | Prev |   1     2   3   4   | Next
    janszoon | # 21 | 2010-01-15, 01:51 | Report

    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*

    Edit | Forward | Quote | Quick Reply | Thanks

     
    simoneb | # 22 | 2010-02-03, 22:29 | Report

    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:
    Originally Posted by
    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.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by simoneb; 2010-05-31 at 20:53. Reason: not very smart to edit rcS-late. added pointer to wiki

     
    Frank Banul | # 23 | 2010-02-03, 23:05 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

    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:
    chrget, simoneb

     
    dsawhney | # 24 | 2010-02-03, 23:12 | Report

    There is already an app for this - http://maemo.org/packages/view/ses/

    Edit | Forward | Quote | Quick Reply | Thanks

     
    pyllyukko | # 25 | 2010-02-04, 07:20 | Report

    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/.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    rooted | # 26 | 2010-02-04, 09:09 | Report

    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...

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by rooted; 2010-02-04 at 17:49.

     
    pir | # 27 | 2010-02-06, 09:31 | Report

    The cron solution works well!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    rooted | # 28 | 2010-02-07, 18:25 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    ruskie | # 29 | 2010-02-07, 19:12 | Report

    You should be safe to remove it. Or point it to /var/run/fcron that's where it usually goes.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    rooted | # 30 | 2010-02-12, 23:29 | Report

    I have another question. Why did you use "adduser", which had to be downloaded and installed instead of already-present "useradd"?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to rooted For This Useful Post:
    simoneb

     
    Page 3 of 4 | Prev |   1     2   3   4   | Next
vBulletin® Version 3.8.8
Normal Logout