|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
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
|
|||
|
|||
|
i wrote a perl script to copy the iplog and message logs to anoter dir to reduce some of the massive log files we get. It works fine when i run it as root, but when i put it in the cron, thats another story. It copies everything fine, and restarts syslogd, but it won't restart iplog. I'm fairly new to perl, and this may be the worst script ever. Any input is welcome.
-Dave ---clipped $date variable--- system("iplog --kill"); system("mv /var/log/messages /root/logs/messages-$date"); system("touch /var/log/messages"); system("mv /var/log/iplog /root/logs/iplog-$date"); system("killall -HUP syslogd"); system("iplog"); }; |
|
#2
|
|||
|
|||
|
Try adding this to the last system() call:
Code:
system("iplog") && die($!);
and then run the script and see what errors come up. If any come up. Other than that, the only thing that comes to mind is that maybe you are didn't set up crontab right. Try setting up the script to run as root under crontab as well (if you didn't already)... |
|
#3
|
|||
|
|||
|
alright thanks for that, when i ran it as root, it worked. Will have to wait and see if it works in the cron. yes, it is running in the roots cron =)
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > perl script + crontab = problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|