Hi to all,
I have a ESX 3.5 where I want to schedule a sh script in crontab but I have this problem:
I create in "root" directory with "chmod 777" a sh file like this:
#!/bin/bash
#----
#
vmware-cmd /vmfs/volumes/storage1/Server2003/Server2003R2.vmx removesnapshots
cp test.txt test1.txt
If I run the sh by console with "./rmsnap.sh" it works fine!
Now I want to shedule on crontab, if I configure the crontab like this it does not works (I put also a cp to verify the execution).
30 21 * * 1 /root/rmsnap-mon.sh
30 21 * * 2 /root/rmsnap-tue.sh
30 21 * * 3 /root/rmsnap-wed.sh
30 21 * * 4 /root/rmsnap-thu.sh
30 21 * * 5 /root/rmsnap-fri.sh
Somebody can help me? I know that problaby it's a stupid ask, but I'm not an expert on linux and I don't understand why it not works!
Thank very much
Augusto
Hi,
- does the crontab-user have execute rights/bits set?
Probably the crontab user if not root (not sure now) probably is not allowed to remove snapshots.
or try
30 21 * * 1 root /root/rmsnap-mon.sh
30 21 * * 2 root /root/rmsnap-tue.sh
30 21 * * 3 root /root/rmsnap-wed.sh
30 21 * * 4 root /root/rmsnap-thu.sh
30 21 * * 5 root /root/rmsnap-fri.sh
hth,
Reinhard
ps: Award points if you find answers helpful. Thanks.
30 21 * * 1 /root/rmsnap-mon.sh
30 21 * * 2 /root/rmsnap-tue.sh
30 21 * * 3 /root/rmsnap-wed.sh
30 21 * * 4 /root/rmsnap-thu.sh
30 21 * * 5 /root/rmsnap-fri.sh
Try
30 21 * * 1 root /root/rmsnap-mon.sh
Syntax:
AWo
If you are looking to you the rmsnap.sh script daily you just put the script in the /etc/cron.daily directory and that will work without having to deal with crontab.
Hi,
I try to put "30 21 * * 1 root /root/rmsnap-mon.sh" but doe not work.
I cannot put it in crond.daily, because each script have small differents for each day of week (mon, tue, wed....)
thank a lot
Augusto.
Hiya,
It most likely isn't working in crontab - as no path statement is available then by default.
So to run scripts via cron - always ensure that you use the full path for all commands in the script.
i.e. run
/usr/bin/vmware-cmd
not just
vmware-cmd
in your script
Dinny