Im trying to set a cronjob using shell code but nothing seems to happen...can anyone see my booboo?
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.
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.