Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> running "wall" command from a script in cron
xadamz23
Posted: May 28 2005, 12:32 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 1019
Joined: 28-May 05



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?
PMEmail Poster
Top
xadamz23
Posted: May 28 2005, 12:44 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 1019
Joined: 28-May 05



Nevermind. I figured it out. I had to include the full path to wall. (/usr/sbin/wall)
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Shells & Scripting | Next Newest »

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.2103 ]   [ 12 queries used ]   [ GZIP Enabled ]




Partners: Cambridge Plus :: <Link Available> :: Stainless Steel Footswitch :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum