Starting a non-root daemon a minute or so after boot-up?
I'm looking for a way to start a non-root daemon a minute or so after
boot-up. I tried the following (see the end of this message), but the
program didn't start, and I didn't get a log file with any error
indications.
I'm sure that I can figure out a variation of the code below that would
work, but instead of making use of some sort of hack, I'd rather use a
utility that's designed for this purpose, if such a thing exists.
The 'fcron' program looked promising, since it's able to measure time
relative to its own startup. However, I can't figure out how to
configure fcron to run a program once and only once.
Here's what I previous tried, which didn't work ...
- Create a file called 'localstart' in /etc/init.d.
- Make sure this file is executable, owned by root, etc.
- Make a symlink to this file from S00localstart in /etc/rc{2,3,4,5}.d
- Here are the contents of /etc/init.d/localstart, which for some
yet-to-be-determined reason didn't work:
#!/bin/sh
case "${1}" in
start)
{
/bin/sleep 120
/bin/su theuser -c \
"/usr/bin/fetchmail -s -f /home/theuser/etc/fetchmailrc"
} >>/var/log/localstart 2>&1 &
;;
esac
Like I mentioned, I'm quite able to debug the code above and eventually
to get it to work. But I'm hoping I can find a utility that might allow
me to do this in a more elegant way.
Any ideas?
Thanks in advance.
--
Lloyd Zusman
ljz@asfast.com
Reply to: