[REBOL] Daemon Workaround - Linux
From: jr::brainbyte::com at: 4-Oct-2000 8:54
Workaround for starting a process as a daemon on LINUX.
1. create a txt file called whatever you want it called
2. put in the file your command line commands to launch your script as
follows:
rebol -c /path/to/script/script.r
3. telnet into your server, you must be root to do this so "su -" to login
as root via telnet
4. copy the text file to one of the following directories which can be
found in the /etc directory:
cron.daily
cron.half-hourly
cron.hourly
cron.monthly
cron.quarter-daily
cron.quarter-hourly (PICK THIS ONE)
cron.weekly
5. now check what time it is by typing "date"
6. if you like you can be more accurate and look at the chron file which
is plain text
in that file you can see all the times that are setup for the above
directories to be executed (well the files inside them anyway)
so if it says:
03,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly (12:03, 12:18,
12:33, 12:48, every 15 minutes)
04,34 * * * * root run-parts /etc/cron.half-hourly (12:04 12:34, every
half-hour)
01 * * * * root run-parts /etc/cron.hourly (12:01 every hour)
05 0,6,12,18 * * * root run-parts /etc/cron.quarter-daily (12:05 AM 6:05 AM
12:05 PM 6:05 PM, 4 times a day)
02 4 * * * root run-parts /etc/cron.daily (4:02 AM every day)
22 4 * * 0 root run-parts /etc/cron.weekly (4:22 AM every Sunday I think)
42 4 1 * * root run-parts /etc/cron.monthly (4:42 AM first day of every month)
so the idea here is that you put it into 1 of these directories, obviously
it should be the one that has the most hits that is /cron.quarter-hourly
and wait for the thing to rollover and auto-start your program/script
now would be a good time to see what time it is "date" and just wait until
the thing has passed your start-time
7. So now check to see if it is running by trying to do whatever it is u
do to check to see if it is running (the program/script that is)
8. If running properly, "rm script.r" remove the script from the cron
directory and be sure to store it somewhere for later use if necessary like
the /tmp directory
thats it, a bit of a hassle but at least it gets the job done when you have
no other way to achieve it.
Good Luck,
Jeff