SMS script...
Mark D. Nagel
mnagel at willingminds.com
Wed Feb 18 20:28:13 CET 2004
Christiaan Ehlers wrote:
> And the sms.sh script is as follow... Deletes one character after the other,
> starting at the back, untill it has 160.
>
> noclobber=0
> FILE=/home/scripts/msg
>
> while [ `wc -m $FILE | awk '{print $1}'` -gt 160 ]
> do
>
> if [ `cat $FILE | sed -n '$p' | wc -m` = 1 ]; then
> cat $FILE | sed '$d' > $FILE
> else
> cat $FILE | sed '$s/.$//' > $FILE
> fi
>
> done
>
> cat $FILE | mail $1
This process can be done just a bit more efficiently -- try this instead:
#! /bin/sh
FILE=/home/scripts/msg
MAILTO=${1-root}
dd if=$FILE count=1 bs=160 2>/dev/null | mail $MAILTO
There's likely many other similar ways; this is just the first that came
to mind.
Regards,
Mark
--
Mark D. Nagel, CCIE #3177 <mnagel at willingminds.com>
Principal Consultant, Willing Minds LLC
tel/fax: 949-623-9853, web: http://www.willingminds.com/
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list