The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Operating Systems
> BSD Help
|
Cron ??? How to make sure it's working
Discuss Cron ??? How to make sure it's working in the BSD Help forum on Dev Shed. Cron ??? How to make sure it's working BSD Help forum discussing all BSD based operating systems including FreeBSD, OpenBSD, NetBSD, and more. BSD refers to the distribution of UNIX originally developed by the University of California at Berkeley.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 19th, 2001, 07:59 PM
|
|
Junior Member
|
|
Join Date: Dec 2001
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Cron ??? How to make sure it's working
hello there,
I have a script that needs to be run each day called whatever.sh
How do I -
1) see if it is already running
2) If it ain't running, how do I start it ?
any help will be greatly appreciated,
cheers,
Adam
|

December 19th, 2001, 11:57 PM
|
|
Contributing User
|
|
Join Date: Jan 2001
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
1) Check the process (ps aux).
Check your /var/cron/log file.
2) It's started automatically on boot by default.
/etc/defaults/rc.conf:
cron_enable="YES"
If you put cron_enable="NO" to /etc/rc.conf, then of course, /etc/rc.conf overrides /etc/defaults/rc.conf, then NO.
If you don't pipe the output to /dev/null, cron by default will send the output to your root email account, if it's a root crontab.
|

December 20th, 2001, 12:18 AM
|
|
Junior Member
|
|
Join Date: Dec 2001
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks a lot for that - cron seems to be running OK,
one question though, I have found some files in the /var/log directory but am unsure if they're the one's I need
/var/log/cron
/var/log/cron.0.gz
/var/log/cron.1.gz
/var/log/cron.2.gz
/var/log/cron.3.gz
I tried to open these files with no luck. Am I doing it right and looking in the right place.
cheers,
Adam
|

December 20th, 2001, 12:50 AM
|
|
Contributing User
|
|
Join Date: Jan 2001
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
First off, sorry for the incorrect info I provided previously. Cron's log should be /var/log/cron instead of /var/cron/log. I got mixed up with NetBSD and OpenBSD because /var/cron/log is the location for them.
>> I tried to open these files with no luck
/var/log/cron is the current one. The ones with *gz extension are rotated by newsyslog (/etc/newsyslog.conf). That said, they are old cron logs. You can view them by zcat, not cat.
|

December 20th, 2001, 12:59 AM
|
|
Junior Member
|
|
Join Date: Dec 2001
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks very much for that, much appreciated.
Is it possible to search those logs to see if and when the script sophos.sh was run ?
cheers,
Adam
|

December 20th, 2001, 01:09 AM
|
|
Contributing User
|
|
Join Date: Jan 2001
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
To search? You should just check your current one /var/log/cron. Just tail it if you don't like cat.
>> when the script sophos.sh was run ?
You mean for the old logs? Then just run: zcat cron*gz | grep "sophos.sh" | awk '{print $1,$2,$3}' >> /root/sophos_log and view your sophos_log any way you want.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|