Your /etc/init.d/script_name
is missing the plumbing that update-rc.d
and so on use, and won't properly handle stop
, start
, and other init-variety commands, so...
For initial experimentation, take advantage of the /etc/init.d/rc.local
script (which should be linked to by default from /etc/rc2/S99rc.local
). The gets you out of having to worry about the init.d conventions and just add things to /etc/rc.local
before the exit 0
at its end.
Additionally, that ~
isn't going to be defined, you'll need to use a full pathname - and furthermore the script will run as root. We'll address how to avoid this if desired in a bit. In any of these, you'll need to replace "whoeveryouare" with something more useful. Also be warned that you may need to prefix the python
command with a su
command and some arguments to get the process to run with the user id you might need.
You might try (in /etc/rc.local
):
( if cd '/home/whoeveryouare/Dropbox/Render Farm 1/appleseed/bin' ; then
while : ; do
# This loop should respawn watchfolder18.py if it dies, but
# ideally one should fix watchfolder18.py and remove this loop.
python ./watchfolder18.py -t ./appleseed.cli -u ec2 ../../data/
done
else
echo warning: could not find watchfolder 1>&2
fi
) &
You could also put all that in a script and just call it from /etc/rc.local
.
The first pass is roughly what you had, but if we assume that watchfolder18.py
will arrange to avoid dying we can cut it down to:
( cd '/home/whoeveryouare/Dropbox/Render Farm 1/appleseed/bin' \
&& exec python ./watchfolder18.py -t ./appleseed.cli -u ec2 ../../data/ ) &
These aren't all that pretty, but it should let you get your daemon sorted out so you can debug it and so on, then come back to making a proper /etc/init.d
or /etc/init
script later. Something like this might work in /etc/init/watchfolder.conf
, but I'm not yet facile enough to claim this is anything other than a rough stab at it:
# watchfolder - spawner for watchfolder18.py
description "watchfolder program"
start on runlevel [2345]
stop on runlevel [!2345]
script
if cd '/home/whoeveryouare/Dropbox/Render Farm 1/appleseed/bin' ; then
exec python ./watchfolder18.py -t ./appleseed.cli -u ec2 ../../data/0
fi
end script