LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 12-12-2003, 01:02 AM   #1
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Rep: Reputation: 15
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
 
Old 12-12-2003, 01:16 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
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.
 
Old 12-12-2003, 01:18 AM   #3
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Original Poster
Rep: Reputation: 15
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
 
Old 12-12-2003, 03:41 AM   #4
Modify
Member
 
Registered: Nov 2003
Distribution: Debian 3.0r1
Posts: 55

Rep: Reputation: 15
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

Last edited by Modify; 12-12-2003 at 03:44 AM.
 
Old 12-12-2003, 10:58 AM   #5
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
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.
 
Old 12-12-2003, 11:10 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
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.
 
Old 12-14-2003, 09:24 PM   #7
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Screen in a cron job LinuxGeek Linux - Software 1 08-03-2005 01:11 AM
script not running as a cron job sanjith11 Programming 5 11-23-2004 09:42 AM
cron job not running vincebs Linux - Software 34 10-30-2004 02:27 PM
Cron job not running in slackware9.1 marri Linux - Software 2 05-06-2004 07:54 AM
Cron Job Not Running pzorn Linux - General 4 10-02-2003 02:38 PM


All times are GMT -5. The time now is 02:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration