More specifically the start-up script:
Code:
#! /bin/bash
/full/path/to/your/program > /dev/null &
echo $! > /var/tmp/myprogrampidfile.pid
exit
and shutdown:
Code:
#! /bin/bash
if [ -f /var/tmp/myprogrampidfile.pid ]
then
/bin/kill $(cat /var/tmp/myprogrampidfile.pid)
fi
Make sure you redirect the output of your program to something else but stderr or stdout.
Use full paths everywhere.
If you run the cron job with root permissions you can store your pid file in /var/run, which is nicer.
Test the scripts outside cron first.
This is untested code!
jlinkels