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

shell script problem

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
sabine



Joined: 07 Mar 2007
Posts: 25
Location: Austria

PostPosted: Tue May 08, 2007 4:12 am    Post subject: shell script problem Reply with quote

Hi,

I wrote a short and simple shell script in Hostmonitor:

Code:
 
#!/bin/sh

cp -p /mnt/tmp/cronbackup/root /var/spool/cron/root
RES=$?
crontab /var/spool/cron/root
RES2=$?

if [ $RES -eq 0 -a $RES2 -eq 0 ]
then
  echo "ScriptRes:Ok: copyEC: "RES", crontabEC: "RES2
else
  echo "ScriptRes:Bad: copyEC: "RES", crontabEC: "RES2
fi 


I use this for copying my backup crontab file to my usual crontab directory.

When executed by RMA 1.24 at RHEL4 on first Computer, it works.

When executed by RMA 1.24 at RHEL4 on second Computer it doesn't work. I get copy Errorcode 1 as Result and crontab Errorcode 0.

When executed by hand directly on RHEL4 everything works fine. Both computers are similar configured (same HW, same SW).

Any ideas what went wrong?

Regards,
sabine
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue May 08, 2007 5:41 am    Post subject: Reply with quote

Hm. It is hard to say what is wrong. I think, there is some configuration issues. Could you verify all settings for the second test? Probably, you have selected wrong agent for "Shell Script" test method? Does rma started under root account on the second system? For the debug purposes, could you replace string "cp -p /mnt/tmp/cronbackup/root /var/spool/cron/root" with the following one:
Code:
cp -p /mnt/tmp/cronbackup/root /var/spool/cron/root 2> /usr/local/s_debug.txt

What exact error do you see in /usr/local/s_debug.txt file?

Regards,
Max
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sabine



Joined: 07 Mar 2007
Posts: 25
Location: Austria

PostPosted: Wed May 09, 2007 1:10 am    Post subject: Reply with quote

Thanks,

got the foult, silly me used wrong agent.

Regards
sabine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting 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