LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron job not running? (http://www.linuxquestions.org/questions/linux-newbie-8/cron-job-not-running-125128/)

james_cwy 12-12-2003 12:02 AM

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

trickykid 12-12-2003 12:16 AM

Re: Cron job not running?
 
Quote:

Originally posted by james_cwy
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

Instead of putting Fri in:

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.

james_cwy 12-12-2003 12:18 AM

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

Modify 12-12-2003 02:41 AM

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]
mail

Blinker_Fluid 12-12-2003 09:58 AM

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.

trickykid 12-12-2003 10:10 AM

Quote:

Originally posted by Blinker_Fluid
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.

That's true, I didn't even notice the username he has put in his cron line as I just pasted what he had and changed the Fri to 5. If your using crontab -e you don't need to specify the user as its only editing the cron for the user your currently logged in as.

james_cwy 12-14-2003 08:24 PM

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 11:52 PM.