bash script from cron
Dear All,
I'm having a problem with a shell script. The script tails syslog and on a specific event, launches another script passing it the contents of the syslog line: #!/bin/bash tail -f /var/log/syslog | while read line ; do if echo $line | grep --quiet RRQ ; then /home/kubla/shellscripts/dhcp_watch/process_log.php "$line"; fi ; done This works perfectly launched from shell. However, I need this script to always run and after logrotate it loses its handle on syslog and while still running according to the process list, it doesn't respond any more. My thought was to create a cronjob that would run 1 minute after logrotate, kill any instances of the script that are running and call the script again. This works but the script continues not to respond to events. Is there something obvious I'm missing? Thanks in advance. |
I should add, I have confirmed that all the paths in all the scripts are correct.
|
Re: bash script from cron
Quote:
As a side note, if you happen to be using a BSD-flavoured tail, '-F' appears to do the same thing. --Misha |
Thanks misaka.
That's done the trick. I've modified the tail line to read: tail --follow=name /var/log/syslog | while read line ; do if and it works a treat! Cheerz |
All times are GMT -5. The time now is 04:19 PM. |