简体   繁体   中英

Cronjob on bitnami google server not working

I have been trying without success to run a cronjob that backs up my database. I keep getting a "30: No such file or directory" when a run the crontab using the following codes on the command line:

crontab 30 19 *** cd /home/bitnami/db_backup /home/bitnami/db_backup/db_backup.sh

But when I run the script by running the below script, It works perfectly.

sh /home/bitnami/db_backup/db_backup.sh

I really do not know what I am missing and I'd appreciate any help in helping me solve this problem. Thanks.

Do crontab -e and add * * * * * bash /home/saketh/Documents/workspace/sample.sh (change the frequency of this job & path accordingly ie 30 19 * * * ; I recommend to use * * * * * bash <absolute path to .sh file> for testing purposes, if the job is small enough) at the end of the file.

I would suggest you to mention absolute path ie the path starting from the root (/) till the end ( /xx/xx/xx/...../sample.sh ) instead of cd /xxx/xxx and bash /continuation/yyy

~#crontab -e

in crontab add:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin

30 19 * * * /home/bitnami/db_backup/db_backup.sh
  • use space between '*'

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