Shell script method on SLES 10

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
jivetolkein
Posts: 96
Joined: Thu Jul 19, 2007 4:35 am

Shell script method on SLES 10

Post by jivetolkein »

Running a shell script method script on standard RMA on SLES 10:

#!/usr/bin/ksh

ERROR=0
STR="down"
ps -ef > /var/tmp/process
for i in cron ntpd postfix\/master beremote
do
if [ `grep -c $i /var/tmp/process` -ne 1 ]
then
ERROR=1
STR=$i" "$STR
fi
done
if [ $ERROR -eq 0 ]
then
echo scriptres:OK:All_backgrounds_active
else
echo scriptres:BAD:$STR
fi


Run from a shell, ps -ef returns processes as expected.

From the shell script above, run via RMA, we get the /var/tmp/process output of ps -ef truncated so its only 80 characters wide.

Any ideas?
jivetolkein
Posts: 96
Joined: Thu Jul 19, 2007 4:35 am

Post by jivetolkein »

FIXED: Setting the TERM and COLUMNS variable in the script sorts it, not necessary on other *nix/linux for some reason.

TERM=xterm
COLUMNS=500
export TERM COLUMNS
[ $# -ne 3 ] && exit


.. on the top of the script..
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

jivetolkein wrote:FIXED: Setting the TERM and COLUMNS variable in the script sorts it, not necessary on other *nix/linux for some reason.
Thank you for your feedback. You save our time. ;-)

Regards,
Max
jivetolkein
Posts: 96
Joined: Thu Jul 19, 2007 4:35 am

Post by jivetolkein »

No problem, I suspect you've saved rather more of mine in the past :-D
Post Reply