简体   繁体   中英

crontab bash script not running

I updated the script with the absolute paths. Also here is my current cronjob entry.

I went and fixed the ssh key issue so I know it works know, but might still need to tell rsync what key to use.

The script runs fine when called manually by user. It looks like not even the rm commands are being executed by the cron job.

UPDATE

I updated my script but basically its the same as the one below. Below I have a new cron time and added an error output.

I get nothing. It looks like the script doesn't even run.

crontab -e

35 0 * * * /bin/bash /x/y/z/s/script.sh 2>1 > /tmp/tc.log

#!/bin/bash
# Clean up
/bin/rm -rf /z/y/z/a/b/current/*
cd /z/y/z/a/to/
/bin/rm -rf ?s??/D????
cd /z/y/z/s/

# Find the latest file
FILE=`/usr/bin/ssh user@server /bin/ls -ht /x/y/z/t/a/ | /usr/bin/head -n 1`

# Copy over the latest archive and place it in the proper directory
/usr/bin/rsync -avz -e /urs/bin/ssh user@server:"/x/y/z/t/a/$FILE" /x/y/z/t/a/

# Unzip the zip file and place it in the proper directory
/usr/bin/unzip -o /x/y/z/t/a/$FILE -d /x/y/z/t/a/current/

# Run Dev's script
cd /x/y/z/t/
./old.py a/current/ t/ 5

Thanks for the help.

I figured it out, I'm use to working in cst and the server was in gmt time.

Thanks everybody for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM