View Single Post
Old 08-26-2013, 08:25 PM   #1
knauck
root
knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.knauck is faster than slow light.
 
Posts: 26
Karma: 29272
Join Date: Jul 2013
Location: ntldll.dll
Device: Kindle Paperwhite
Best way to exec script on boot

If you want to execute a script on boot, use /etc/upstart. The following methods will NOT work:
  • /etc/crontab/root with @reboot task
  • /etc/init.d/
  • /etc/rc.local

Make a file with the extension '.conf' and add a start condition and a stop condition as your first and second lines. Be sure your script and your .conf are unix format and not windows. (CRLF is bad and will make big problems.)

For example: /etc/upstart/fubar.conf
Code:
start on started lab126_gui
# This line tells init.d where in the boot process to start this script. Good
# places are "start on started framework" if you need it to run after the
# framework daemon is running. "start on started lab126_gui" tells it to run
# after the ui is up. That is the final phase of the boot process.

stop on stopping lab126_gui
# This tells the system when in the shutdown process to kill your script. If
# you are just running a single command, this isn't terribly important.

script
	# exec /bin/sh /your/script/here.sh
	exec /bin/bash /var/local/dev/somescript.sh
end script
** !! NOTICE !! ** !! NOTICE !! ** !! NOTICE !! ** !! NOTICE !! **

If you choose to remove whatever this conf points to, you MUST MUST MUST delete this from the upstart folder. If anything in this folder errors out there is a very good chance your kindle will fail to boot!

Original question:
Spoiler:
As title implies, I am looking for the best way to effectively run a single script at boot time. This may be done after framework has started.

So far I have tried using @reboot in crontab, a conf file in /etc/upstart, and a service in init.d, none of which worked...what am I missing?

Last edited by knauck; 08-28-2013 at 12:04 PM.
knauck is offline   Reply With Quote