Gossamer Forum
Home : General : Internet Technologies :

Create cronjob using shell code

Quote Reply
Create cronjob using shell code
Im trying to set a cronjob using shell code but nothing seems to happen...can anyone see my booboo?

Code:
#!/bin/sh

echo "Adding cronjob..."

cat >cron.txt <<EOF
*/15 * * * * /path/to/something.cgi
EOF

cat >cron.c <<EOF
#include <stdlib.h>
main() {
system("crontab -l > cron.txt");
system("crontab -e < cron.txt");
}
EOF

if ! cc cron.c -o cron_install 2>/dev/null; then
echo "...error." ; exit 1
fi
echo "...done."

Do I now need to execute cron_install ?....is that what I'm missing?

I'm open to hearing a better way to do it...I'm sure I don't have to compile cron.c first.

Last edited by:

Paul: Jul 2, 2002, 11:51 AM
Subject Author Views Date
Thread Create cronjob using shell code Paul 8332 Jul 2, 2002, 11:39 AM
Thread Re: [Paul] Create cronjob using shell code
Andy 8156 Jul 2, 2002, 1:37 PM
Thread Re: [Andy] Create cronjob using shell code
Paul 8062 Jul 2, 2002, 1:39 PM
Thread Re: [Paul] Create cronjob using shell code
Andy 8118 Jul 2, 2002, 1:46 PM
Post Re: [Andy] Create cronjob using shell code
Paul 8040 Jul 2, 2002, 1:50 PM
Thread Re: [Paul] Create cronjob using shell code
brewt 8030 Jul 2, 2002, 4:46 PM
Thread Re: [brewt] Create cronjob using shell code
Paul 8047 Jul 2, 2002, 4:52 PM
Thread Re: [Paul] Create cronjob using shell code
brewt 7997 Jul 2, 2002, 11:58 PM
Post Re: [brewt] Create cronjob using shell code
Paul 8063 Jul 3, 2002, 2:12 AM