|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > BSD Help > Cron ??? How to make sure it's working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|