LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   cron is not workin well running a custom script on Slackware 10.1... (https://www.linuxquestions.org/questions/linux-software-2/cron-is-not-workin-well-running-a-custom-script-on-slackware-10-1-a-477077/)

sugar2 08-24-2006 05:59 PM

cron is not workin well running a custom script on Slackware 10.1...
 
cron is not workin well running a custom script on Slackware 10.1...


Hi, I tried scheduling this crontab as a roor or as a user called 'cuser'
this is the crontab (without quotes):
'27 15 * * * /home/cuser/custom-scripts/cron-backups.sh>/dev/null 2>&1'

Of course, the shell script has 775 permisions, weirdo thing is that the command can be runned ok from the standar shell, but under cron it just doesnt run... do you think it could be due the use of YYYY-MM-DD_HHMM input switches on the 'rar' program or the '-mtime +365' argument used in find command passed to the cron-backups.sh script?

This is the 'cron-backups.sh' shell script:
Code:

#!/bin/sh
#
find /mnt/usb-storage/MyCompany-SERVER-OM -type f -mtime +365 | xargs rm -f;
rar a -k -rr3%% -dh -m2 -y -pMyPassword -hpMyPassword -tk -o+ -t -ep1 -agYYYY-MM-DD_HHMM /mnt/usb-storage/MyCompany-SERVER-OM/OMBACKUP- /mnt/mounted-nas1/OrderManager;
find /mnt/usb-storage/MyCompany-SERVER-QB -type f -mtime +365 | xargs rm -f;
rar a -k -rr3%% -dh -m2 -y -pMyPassword -hpMyPassword -tk -o+ -t -ep1 -agYYYY-MM-DD_HHMM /mnt/usb-storage/MyCompany-SERVER-QB/QBBACKUP- /mnt/mounted-nas1/Shared/QBook;
cp -f -r -u /mnt/mounted-nas1/. /home/nas2/workware-mirror/;
find /mnt/usb-storage/MyCompany-SERVER-SNAPSHOT -type f -mtime +30 | xargs rm -f;
rar a -k -v1900m -sv- -rr3%% -dh -m1 -y -pMyPassword -hpMyPassword -tk -o+ -ep1 -s -md512 -agYYYY-MM-DD_HHMM /mnt/usb-storage/MyCompany-SERVER-SNAPSHOT/WORKWARE-SNP- /mnt/mounted-nas1;
find /mnt/usb-storage/POS-SERVER-MAINTENANCE -type f -mtime +90 | xargs rm -f

thanks in advance.

jailbait 08-24-2006 07:09 PM

"weirdo thing is that the command can be runned ok from the standar shell, but under cron it just doesnt run"

cron has a much shorter PATH than root or user. Try using the full pathname for each of the commands that you execute.

---------------------
Steve Stites

sugar2 08-24-2006 07:20 PM

I call the shell script for cron using the full path: '/home/cuser/custom-scripts/cron-backups.sh'
i will try... bue i will try using full paths in the shell script too...
i will post results here

sugar2 08-24-2006 07:41 PM

It works now!
I just added the full path for each command used in the script... thanks jailbait!!


All times are GMT -5. The time now is 05:11 PM.