KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Shell script method on SLES 10

 
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX
View previous topic :: View next topic  
Author Message
jivetolkein



Joined: 19 Jul 2007
Posts: 96

PostPosted: Mon Feb 25, 2008 9:57 am    Post subject: Shell script method on SLES 10 Reply with quote

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?
Back to top
View user's profile Send private message
jivetolkein



Joined: 19 Jul 2007
Posts: 96

PostPosted: Tue Feb 26, 2008 3:37 am    Post subject: Reply with quote

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..
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue Feb 26, 2008 3:52 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jivetolkein



Joined: 19 Jul 2007
Posts: 96

PostPosted: Tue Feb 26, 2008 4:20 am    Post subject: Reply with quote

No problem, I suspect you've saved rather more of mine in the past
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index