Hello
I wrote a nice Perl script that is intended to find and copy some files when getting a TERM signal. Now I wanted to make a shell script that starts/restarts the Perl script if it crashes/ends because of errors and make a log of all output the Perl Script gives. The problem is that it won't write any output to my logfile
Here is my Shell script:
#!/bin/sh
pidcheck=`pidof perl | grep -c [0-9][0-9][0-9][0-9]`
while [ $pidcheck -ne 0 ]
do
kill -9 `pidof perl`
done
echo "\n------------------------------\n" >> log.txt
date >> log.txt
echo "\n------------------------------\n" >> log.txt
while [ 1 -eq 1 ]
do
`perl handler.pl >> log.txt`
echo "Perl-Script crashed, restarting..." >> log.txt
done
I think it would write if I don't put the `` around `perl handler.pl >> log.txt`, but then I can't send any signals to my perl script
Can (maybe) someone help me? ^^' thanks in advance and sorry for my bad english :rolleyes: