display warning messages on command line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting display warning messages on command line
# 1  
Old 02-21-2009
display warning messages on command line

I have made a script to print size of a slice if it reaches more then 80% which is working fine no problem in it.

I want to add this script in crontab to print this message on command line every half hour if slice size reaches more then 80%.
here is the line below i added on crontab

30 * * * * /osp/local/home/linus/test.sh

The problem is crontab is running but not displaying any text on command line, i cheched it by redirecting test.sh

Code:
#cat test.sh
 
#/usr/sbin/ksh
#set -x
df -k | grep var |grep c1t0d0s3 > test.txt
cat test.txt | nawk -F " " '{printf "%s\n" , $5}' > test1.txt
#m=`cut -d " " -f 1 test1.txt`
sed 's/%//g' test1.txt > red3
m=`cut -d " " -f 1 red3`
if [ $m -gt 80 ];
then
echo your /var size is $m% kindly remove some space"
echo
fi
 
#
#

# 2  
Old 02-21-2009
Quote:
Originally Posted by Danish Shakil
crontab is running but not displaying any text on command line
If Syslog is configured to dump certain facility.priority level messages to the console you could check 'logger'. Or maybe else check 'write' or 'wall' but I don't know if crond process owner would be allowed that.
# 3  
Old 02-22-2009
Quote:
Originally Posted by Danish Shakil
The problem is crontab is running but not displaying any text on command line, i cheched it by redirecting test.sh

Which command line would you want cron to print to? How could it know?
Quote:

Code:
#cat test.sh
 
#/usr/sbin/ksh
#set -x
df -k | grep var |grep c1t0d0s3 > test.txt
cat test.txt | nawk -F " " '{printf "%s\n" , $5}' > test1.txt
#m=`cut -d " " -f 1 test1.txt`
sed 's/%//g' test1.txt > red3
m=`cut -d " " -f 1 red3`
if [ $m -gt 80 ];
then
echo your /var size is $m% kindly remove some space"
echo
fi
 
#
#

Code:
m=$( df -k | 
nawk -F " " '/var/ && /c1t0d0s3/ {
 sub( /%/, "", $5)
 printf "%s\n" , $5 }'
)

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

How to display certain line of file only using head or tail in 1 command?

First month learning about the Linux terminal and it has been a challenge yet fun so far. We're learning by using a gameshell. I'm trying to display a certain line ( only allowed 1 command ) from a file only using the head or tail. I'm pretty about this answer: head -23 history.txt | tail -1... (1 Reply)
Discussion started by: forzatekk
1 Replies

2. HP-UX

Display SAM user list at the command line

Hello, I've been doing Linux and AIX administration for years, but I'm very new to HPUX. We have an old audit process which involves someone manually using sam to generate user lists. I'd like to kill that old process with fire... But... After working a bit in the morning to try and pull... (3 Replies)
Discussion started by: Celt1977
3 Replies

3. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

4. Shell Programming and Scripting

using sed command to display contents where line numbers are stored in variables

if i want to display the contents of a file between say line number 3 and 10 then i use the following command sed -n '3,10p' filename if this 3 was contained in x and 10 was contained in y then how wud this command modified? sed -n '$x,$yp' filename does not work..please advise (2 Replies)
Discussion started by: arindamlive
2 Replies

5. Shell Programming and Scripting

Display Specific line number using tail command

Hi , 1)i want to display specific line number using tail command. e.g. display 10 line from end. Please help... 2)Want to display line 10 to 15 (from end)using tail command) (2 Replies)
Discussion started by: vivek1489
2 Replies

6. Shell Programming and Scripting

Need a Command To display "echo command value in loop" in single line.

Hi I want to display "echo command value in loop" in single line. My requirement is to show the input file (test_1.txt) like the output file (test_2.txt) given below. Input file :test_1.txt a1|b1|4|5 a1|b1|42|9 a2|b2|32|25 a1|b1|2|5 a3|b3|4|8 a2|b2|14|6 Output file:test_2.txt... (2 Replies)
Discussion started by: sakthifire
2 Replies

7. UNIX for Advanced & Expert Users

Command to display nth line before the string is matched.

All, Is there any way out to display the nth line before the string is matched ??? Eg : If i have a file which has the following contents and if i want to get the 3rd line before the string is matched a b c d e f if i give the input as f and lines before the match as 3 then it should... (5 Replies)
Discussion started by: helper
5 Replies

8. UNIX for Dummies Questions & Answers

display full unix path as part of the command line

Hi all, Does anyone know how to ammend the .cshrc file in $HOME for your session to display the path as part of the command line? So that I dont need to keep on typing pwd to see where I am? thanks Ocelot (3 Replies)
Discussion started by: ocelot
3 Replies

9. Windows & DOS: Issues & Discussions

Display Printers via command line

Is there an easy way to view all printers on a local machine via command line or a script? I'm looking for the equivalent of clicking on "START, CONTROL PANEL, PRINTERS AND FAXES" to view the devices. I then want to cat it to a file where I would use it later. Thanks (3 Replies)
Discussion started by: gseyforth
3 Replies

10. UNIX for Dummies Questions & Answers

how to concatenate two command in one line and get the display in one screen

Hi, I would like to know , how to concatenate two command in one line and get the display in one screen for eg command 1 : ls -l /data/logs command 2 : ls -l /data/errors output shd be /data/logs /data/errors xx-xx-xx-xx abc.log xx-xx-xx-xx... (9 Replies)
Discussion started by: vasikaran
9 Replies
Login or Register to Ask a Question