So I've been tasked with creating a shell script to run in a cron every few minutes to check duplex settings on my eth0 nic card. I would like for the server to send a wall message to whoever is on the console or in a terminal session. Below is what I have so far.
0,10,20,30,40,50 * * * * /home/acc4000d/test10
I have it in my root's cron so that wall will run. Can someone tell me what I'm missing for the wall to actually happen?
Script looks like this;
#!/bin/bash
DUPLEX=$(ethtool eth0 | sed -n 's/Duplex:\(.*\)/\1/p')
if [ $DUPLEX = Half ]
then /usr/bin/wall duplex_error
fi
annnnd the wall message file is called "duplex_error"
Strange. I would have bet it did. - This is from my current system's man page:
WALL(1) BSD General Commands Manual WALL(1)
NAME
wall -- write a message to users
SYNOPSIS
wall [-g group] [file]
DESCRIPTION
The wall utility displays the contents of file or, by default, its standard input, on the terminals of all currently logged in users.
And here I was thinking "wall" was some kind of standard command.
I'm not seeing wall output my message. However, if i just run the script, it outputs the wall message to console as expected. So for some reason i can't get it to run properly from the cron itself.
---------- Post updated at 03:38 PM ---------- Previous update was at 03:35 PM ----------
I even added a log file to write to and i get no output to it either.
#!/bin/bash
DUPLEX=$(ethtool eth0 | sed -n 's/Duplex:\(.*\)/\1/p')
if [ $DUPLEX = Half ]
then /usr/bin/wall /home/acc4000d/duplex_error
echo > /home/acc4000d/boogers_`date +\%b\%d\%y\%H\%M`.log 2>&1
fi