Answer the question
In order to leave comments, you need to log in
Why does the script not work through crontab?
There is a simple script for backup
#!/bin/bash
ssh -2 [email protected] "mysqldump -uUSR -pPASS DB_NAME | gzip -9" > /media/backups/DB-LIVE-$(date +%Y-%m-%d-T%H-%M).sql.gz
ls -t1 /media/backups/ |tail -n +25| xargs rm -f
0 * * * * /opt/backup.sh
Answer the question
In order to leave comments, you need to log in
by default, cron does not use environment variables
in particular PATH
, so it does not know where the interpreter is located
/bin/bash/ls -t1 /media/backups/ |tail -n +25| /bin/bash/xargs rm -f
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question