Hello,
Ive written a little script that broadcasts a message if certain criteria are met. The script works fine when I run it.
I entered it in the crontab to run every hour on the hour. The script executes, but the wall command doesnt seem to be executing correctly. I only have this problem when running the script from the crontab. My script is below:
#!/bin/sh
# This script checks for core files and broadcasts a message
# to all users if any are found.
# Created 02/25/2003 by Adam
if [ ! -f /tmp/fndcore.log ]
then
touch /tmp/fndcore.log #Creates log file if it doesn't exist
fi
# Check size of log file before updating it
SIZE1=`cat /tmp/fndcore.log | wc -c`
find / -name core -print > /tmp/fndcore.log #Update log file
# Check size of log file after updating it
SIZE2=`cat /tmp/fndcore.log | wc -c`
if [ $SIZE2 != 0 ] && [ $SIZE1 != $SIZE2 ]
then
cat /tmp/fndcore.log | wall #Broadcast message
fi
Any ideas as to why the wall command isnt executing correctly when the script is run through cron?