Page 1 of 1

Shell script method on SLES 10

Posted: Mon Feb 25, 2008 9:57 am
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?

Posted: Tue Feb 26, 2008 3:37 am
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..

Posted: Tue Feb 26, 2008 3:52 am
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

Posted: Tue Feb 26, 2008 4:20 am
by jivetolkein
No problem, I suspect you've saved rather more of mine in the past :-D