Reputation: 83
#!/bin/bash
docker exec -ti erpnext sh -c "cd /home/frappe/frappe-bench/ &&
/usr/local/bin/bench backup"
echo 'Hello, world.' >foo.txt
The above code is my bash file. Here have two command
If I run this command
cd /home/arifur/workspace_python/erpdatabasebackup && bash backup_database.sh
in terminal then it is working
But when I run in crontab
* * * * * cd /home/arifur/workspace_python/erpdatabasebackup && bash backup_database.sh
then only txt file creation is working but docker container is not working.
Upvotes: 1
Views: 1506
Reputation: 2557
The -ti
requests to use a pseudo-tty and run in interactive mode but cron does not attach to any TTY. Try removing -ti
as in
docker exec erpnext sh -c "cd /home/frappe/frappe-bench/ && /usr/local/bin/bench backup"
Upvotes: 5