View Full Version : Upon Startup
December 1st, 2009, 11:23 PM
OK, So just wondered how could i execute a text file to run in terminal upon start-up preferable hidden? Pretty simple I hope ;-)
December 1st, 2009, 11:37 PM
Do you want it to run as a daemon so it only shows up in the system monitor, perhaps putting a PID file in /var/run/somefile.pid???
If that's the case I've done it by putting a calling script in /etc/init.d and the running script is in ~HOME/bin/daemons. The daemon script is picsdaemond and it generates a PID file and runs until it either detects a stop file or the machine is shut down/rebooted.
There may be other/better ways to do this but this has been working flawlessly on my machine for weeks. I initially had it generate a logfile of it's actions and nothing was abnormal so I removed that feature.
Once the calling script is placed in /etc/init.d/somefilename you'll have to update the init scripts with sudo update-rc.d somefilename defaults. See the manpage on update-rc.d to be aware of all of the options.
# Start picsdaemond daemon that renames and moves
# downloaded .jpg files.
bash -c /home/barrie/bin/daemons/picsdaemond 1>/dev/null 2>/dev/null &
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.