[20.03.2014 23:17] [Martin Vaner]: > Hi Martin, > > root@CSMS-MontageTV:/usr/local/bin# ls -l /bin/bash > -rwxr-xr-x 1 root root 975488 Dec 30 2012 /bin/bash > root@CSMS-MontageTV:/usr/local/bin# > > It is exit. So, when i run the script from the console, i just getting > this output: > > root@CSMS-MontageTV:/mnt/vouchers# bash -x logtest.sh > ++ tail -n 10 contego.log > ++ grep Error > ++ wc -l > + errorcount=0 > + '[' 0 -gt 0 ']' > + echo 0 > 0 > + exit 0 > root@CSMS-MontageTV:/mnt/vouchers# > > If i run the script form the console directly, it is working fine.
Often that's a sign that the PATH environment variable is not set correctly. Try inserting PATH=/bin:/usr/bin:/sbin:/usr/sbin as second line in the file. And/Or use absolute paths to the commands in the script, like errorcount=$(/usr/bin/tail -n 10 /mnt/vouchers/contego.log | \ /usr/bin/grep -c Error) to get the number of 'Error' lines. The line break is due to the line length and my MUA ;-) HTH, Werner -- -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
