shell script problem

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
sabine
Posts: 25
Joined: Wed Mar 07, 2007 6:22 am
Location: Austria

shell script problem

Post by sabine »

Hi,

I wrote a short and simple shell script in Hostmonitor:

Code: Select all

 
#!/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
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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: Select all

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
sabine
Posts: 25
Joined: Wed Mar 07, 2007 6:22 am
Location: Austria

Post by sabine »

Thanks,

got the foult, silly me used wrong agent.

Regards
sabine
Post Reply