Wall execution problems from cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Wall execution problems from cron
# 1  
Old 03-27-2013
[SOLVED]Wall execution problems from cron

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.


Code:
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;


Code:
#!/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"

Last edited by lutador72; 03-27-2013 at 08:02 PM..
# 2  
Old 03-27-2013
I don't see anything wrong. What is the script doing or not doing?
# 3  
Old 03-27-2013
I don't think wall takes a file -- it'd just print 'duplex_error' instead of printing the message from that file.

Code:
xargs wall < duplex_error

This User Gave Thanks to Corona688 For This Post:
# 4  
Old 03-27-2013
Quote:
Originally Posted by Corona688
I don't think wall takes a file
Strange. I would have bet it did. - This is from my current system's man page:

Code:
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.
# 5  
Old 03-27-2013
Quote:
Originally Posted by verdepollo
I don't see anything wrong. What is the script doing or not doing?
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.

Code:
#!/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

# 6  
Old 03-27-2013
Quote:
Originally Posted by lutador72
I'm not seeing wall output my message
It may not be finding the location of ethtool and/or sed. Try using full paths just as you did with wall.
Code:
DUPLEX=$(/usr/bin/ethtool eth0 | /usr/bin/sed -n 's/Duplex:\(.*\)/\1/p')

This User Gave Thanks to verdepollo For This Post:
# 7  
Old 03-27-2013
Quote:
Originally Posted by verdepollo
It may not be finding the location of ethtool and/or sed. Try using full paths just as you did with wall.
Code:
DUPLEX=$(/usr/bin/ethtool eth0 | /usr/bin/sed -n 's/Duplex:\(.*\)/\1/p')

That did the trick, my friend, thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Good evening, ive got this cron to be run: if i run this manually it doesnt work,it takes me to the prompt again /export/app/CO/opge/scr/Informe_parametros_colombia.ksh >/dev/null 2>&1 here is the code fragment: coopge@coopge: opge PRODUCCION>more... (1 Reply)
Discussion started by: alexcol
1 Replies

3. SuSE

Wall execution problems from cron

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 * * * * ... (1 Reply)
Discussion started by: lutador72
1 Replies

4. Shell Programming and Scripting

Execution problems with cron

I am new to creating crontab file , i just wrote below (40 19 * 3 * /root/maths/practisecron.sh), the script just prints "Hi". When ever i save the above file i am getting this . # crontab -e crontab: installing new crontab Can you please check where it went wrong.. (1 Reply)
Discussion started by: vkiyv05
1 Replies

5. UNIX for Dummies Questions & Answers

Dsh command : Execution Problems with Cron

Hi, On linux cluster, i created a script to delete all temp files older than 5 days. i am able to execute the script "dsh -ea script.ksh" in management node directly But when i schedule "dsh -ea script.ksh" in crontab in management node it tells dsh command not found. How to solve... (2 Replies)
Discussion started by: smartrajusid
2 Replies

6. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Hi friends, today i created a cron job , registered the crontab file associated but dont know why the cron is not getting executed at the right time.?? content of Crontab file : 21 15 * * * /subrat/myt i wanted to execute the script myt on 15:21 PM of everyday. the script myt... (2 Replies)
Discussion started by: paras.oriental
2 Replies

7. Shell Programming and Scripting

Execution Problems with Cron

Hi, I have written a shell script to transfer files to a SFTP server passing the filername, source and dest directory as parameters and it runs well. :) I want to schedule this script to run periodically using a cron job. root@pingu # cat /etc/crontab SHELL=/bin/bash... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

8. UNIX and Linux Applications

Execution Problems with Cron

Hi all!! I have a nerve-wracking concept (probably for me!!) which is not understood. My crontab entry looks this way. 33 09 22 3 * /home/myexp.sh "Bgp4 ALL" >/dev/null 2>&1 But cron gets started occasionally. Sometimes it does. Sometimes it does not. And sometimes it hangs in the middle (I... (1 Reply)
Discussion started by: dhivyasuresh
1 Replies

9. Programming

execution problems with cron

how to store a date into file? and how we can access date from the file? ---------- Post updated at 06:09 AM ---------- Previous update was at 06:08 AM ---------- how we can store date in file? (1 Reply)
Discussion started by: causalmodi777
1 Replies

10. UNIX for Advanced & Expert Users

Cron wall message problem

Operating system sun solaris 5.8 My problem is : crontab -e 15 16 * * * /bckscripts/oo vi /bcscripts/oo = wall " stop backup " the system at the 16:15 all day time doesn't display message " stop backup " What's the problem ??? i'am root user the follow is the root dir... (2 Replies)
Discussion started by: tt155
2 Replies
Login or Register to Ask a Question