Notices


Reply
Thread Tools
Posts: 136 | Thanked: 263 times | Joined on Nov 2012 @ Germany
#1
How can the clock app be started from command line? "/usr/bin/worldclock" won't show up the clock gui, nor will "run-standalone.sh worldclock".

I want to put the command in an autostart-script:

/etc/event.d/autostart:
Code:
start on started hildon-desktop
exec su user -c /home/user/autostart.sh
/home/user/autostart.sh:
Code:
#!/bin/sh

/COMMAND TO START CLOCK
sleep 3
run-standalone.sh /opt/cooktimer/cooktimer
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#2
First: cooktimer is not worldclock
Second: in general worldclock can be started via command line just like hou described (but you should detach with a trai'ing ampersand '&')
Third: is your script executable? [chmod +x ...]
Fourth: / is not a comment, exchange with #
try once more
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 1,100 | Thanked: 2,797 times | Joined on Apr 2011 @ Netherlands
#3
Cooktimer is just something else he wants to have at startup (used as example I guess)

I am afraid Rasmarc is not lucky enough to have CSSU-testing or the worldclock replacement installed.

The default worldclock is not a standalone executable, but a shared object. It cannot be launched as a standard executable.

This should do the trick:

Code:
dbus-send --type=method_call --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:"worldclock"
 

The Following 6 Users Say Thank You to ade For This Useful Post:
Posts: 136 | Thanked: 263 times | Joined on Nov 2012 @ Germany
#4
As Ade said, the autostart.sh script should launch worldclock and cooktimer. And with the provided code everything works fine as long as the script ist started from a terminal (worldclock is launched and the script is detached after cooktimer is launched).

Code:
#!/bin/sh

dbus-send --type=method_call --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:"worldclock"
sleep 3
run-standalone.sh /opt/cooktimer/cooktimer &
When started automatically from /etc/event.d/autostart the dbus command doen't work. Adding the line "start on started dbus" into that script (without knowing what i'm doing) brought no success.

Seaching brought me to this thread: Run script on startup with access to dbus session bus... but i don't know if the problem there is similar.

I cannot install the worldclock replacement. The application manager doesn't list it and installing by launching the .deb file is refused because of incompatibility.
 
Posts: 2,290 | Thanked: 4,134 times | Joined on Apr 2010 @ UK
#5
Is it not better to make a upstart script instead of triggering a script with upstart.
http://upstart.ubuntu.com/cookbook/
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following User Says Thank You to sixwheeledbeast For This Useful Post:
Posts: 136 | Thanked: 263 times | Joined on Nov 2012 @ Germany
#6
Originally Posted by sixwheeledbeast View Post
Is it not better to make a upstart script instead of triggering a script with upstart.
http://upstart.ubuntu.com/cookbook/
Probably it is, but that won't resolve the dbus problem. The only reason i triggered a script was to avoid a recurring "exec su user -c".

So i would like to know either how to get access to the relevant dbus session (i guess ) or how to get the clock replacement installed (in fact i'm interested in both).
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#7
Tested the dbus command and it works fine when executed as root (and also as 'su user -c ...', so no idea. I did not test to execute it as service.

About worldclock installment:
please read from here and download the deb, extract it and simply replace /usr/bin/worldclock. Should do the trick.


--edit
just checked with file in /etc/event.d and indeed it fails with "Failed to open connection to "session" message bus: (null)"
But simply preceeding with run-standalone.sh works.

description "start worldclock on boot"

author "peterleinchen"

start on started hildon-desktop

#respawn

exec su user -c "run-standalone.sh dbus-send --type=method_call --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:\"worldclock\""
Please note the escaped " around worldclock.
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature

Last edited by peterleinchen; 2015-04-14 at 11:10.
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 136 | Thanked: 263 times | Joined on Nov 2012 @ Germany
#8
Solved, many thanks. Just an ampersand was missing again at the end of the line in order to get subsequent lines executed. And if there's more than one command the lines "script" and "end script" must be inserted. Finally I copied the clock replacement.
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#9
Originally Posted by rasmarc View Post
Solved, many thanks. Just an ampersand was missing again at the end of the line in order to get subsequent lines executed.
Talking about your script? Or the one in event.d?

more than one command the lines "script" and "end script" must be inserted.
.
True. But then you do not need the 'exec' anymore.

So in above script there should not be the need for ampersands. Except you call a full binary directly. As this line would wait for termination of that binary ().
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Posts: 136 | Thanked: 263 times | Joined on Nov 2012 @ Germany
#10
If a script is triggered no ampersand is needed in /etc/event.d/autostart:
Code:
start on started hildon-desktop

script

sleep 30
exec su user -c "/home/user/autostart.sh"

end script
But in the triggered script:
Code:
#!/bin/sh

run-standalone.sh /usr/bin/worldclock &
sleep 1
run-standalone.sh /opt/cooktimer/cooktimer &
Otherwise subsequent lines will not be executed until the "blocking" application is closed.

Without a triggered script /etc/event.d/autostart looks like this:
Code:
start on started hildon-desktop

script

sleep 30
exec su user -c "run-standalone.sh /usr/bin/worldclock" &
sleep 1
exec su user -c "run-standalone.sh /opt/cooktimer/cooktimer" &

end script
The ampersands have to be added at the end. If put inside the quotation marks subsequent lines will not be executed even if the blocking application is closed.

If "exec..." is omitted the applications run as root even inside "script" / "end script" (at least on my N900).

Maybe there's something strange with my maemo installation. "ssh status and switcher" blocked my hildon status menu until I added an "&" to the relevant lines in the script, see this thread.
 

The Following 2 Users Say Thank You to rasmarc For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 01:54.