Issue
I tried different options to automatically run the backup script, it just doesn't work. Everything is fine in the logs, everything shows that the launch is in progress. What could be the problem? The script works when started manually. Script:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/nino_new/nino
now=$(date +"%d-%m-%y_%H:%M:%S")
filename=backups/nino_$now.json
docker exec -ti skill01 python manage.py dumpdata -o $filename -a
crontab:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/nino_new/nino
* * * * * sh /root/nino_new/nino/backup.sh
Solution
Try to remove the sh
after * * * * *
and let only the path to the script.
Answered By - Alex Manea