Cron job not running?
My scripts are located in /root/bin:
start-p0f.sh #!/bin/sh # # p0f startup script. # # # PURPOSE: To start the p0f process # Add '-d' to command line for debug information set -x # Start p0f /root/UMThesis/p0f2003/p0f/p0f > /root/UMThesis/p0f2003/output.txt stop-p0f.sh #!/bin/bash # # p0f stop script. # # # PURPOSE: To stop the p0f process # Add '-d' to command line for debug information set -x # Stop p0f killall -15 p0f I tried running cron today on friday, I tried both Fri and 5: 30 13 * * Fri root /root/bin/start-p0f.sh 40 13 * * Fri root /root/bin/stop-p0f.sh But the cron job will not run.What did I do wrong? In addition,when I run start-p0f.sh by itself, it is OK. Also when I run stop-p0f.sh by itself, it says:bash: /root/bin/stop-p0f.sh: Permission denied What is actually wrong? This is the detailed description of the problem that I am facing. Hope someone can help me, please.:) Thanks a million |
Re: Cron job not running?
Quote:
30 13 * * Fri root /root/bin/start-p0f.sh Why not put a 5 which would be the correct way like this: 30 13 * * 5 root /root/bin/start-p0f.sh Also make sure you even have the cron daemon running as well. Regards. |
Tried using 5 but could not
Yes I did use 5 but it still cannot run.
Also, how to make sure that cron daemon is running as well. I am new at this so hope you can provide some guidance. Thanks |
there's probably an easier way, but if I'm checking for a running process, i use:
ps aux | grep [process name] So in this case I'd use ps aux | grep cron result: /--02:34 AM \--modify@penance:~$ ps aux | grep cron root 394 0.0 0.1 1744 676 ? S Dec09 0:00 /usr/sbin/cron modify 16397 0.0 0.0 1540 508 ttyp1 S 02:39 0:00 grep cron /--02:39 AM \--modify@penance:~$ Edit: Since you're running that as user root (assuming you don't have any aliases set up), any status/error/output messages generated by that cron job would get sent to root; you might try checking root's mail to see if anything interesting is in there. su [password] |
When I set up a cron job I become whatever user I want it to run as and do a 'crontab -e' Then I just put in the crontab like so:
30 13 * * 5 /root/bin/start-p0f.sh I don't usually see the username listed in the cron line. |
Quote:
|
Run for one hour
Thanks for all the replies ealier.
Another question:Can I make p0f run for one hour per day and then kill it using the stop-p0f .sh without say example specifying the actual time? Thanks James |
All times are GMT -5. The time now is 08:12 PM. |