I have a list of cron jobs.
00 21 * * * sh ~/db_backup.sh
20 21 * * * sh ~/update.sh
* 5 1 * * sh ~/db_vacuum.sh
The first job makes a backup of a database I have running on an Ubuntu server, this works as I verify the date the backup file was last modified using:
date -r db.sql
My third cron job just vacuums my db at the start of every month. My issue is in my second job. This job executes several url callbacks on a DJango application I am running:
sudo docker exec -it web_1 wget -t 0 "http://127.0.0.1:8080/admin/command1"
sudo docker exec -it web_1 wget -t 0 "http://127.0.0.1:8080/admin/command2"
sudo docker exec -it web_1 wget -t 0 "http://127.0.0.1:8080/admin/command3"
sudo docker exec -it web_1 wget -t 0 "http://127.0.0.1:8080/admin/command4"
I check the expected outputs and it seems the file was not executed at all, the strange thing is if I execute it manually with the command:
sh ~/update.sh
It runs flawlessly, is there some catch with wgets I am missing? In case it is not obvious, the wget commands are pointing towards a docker container running the server.
UPDATE:
I tried attaching log files as output files to the wget commands in my .sh file. After checking back after the established cron job execution time, there were no log files in the directory.
I then checked the actualy system logs and I noticed this message appeared in the log the second after my .sh file was executed.
(CRON) info (No MTA installed, discarding output)
Could this be related somehow?
docker
doesn't require thesudo
password, right?/usr/bin/docker
docker
group (grep '^docker' /etc/passwd
)docker
requires thesudo
password; ifdocker
requires thesudo
password and you didn't adddocker
toNOPASSWD
in/etc/sudoers
, thesudo
command is halting the execution of the script./bin/sh
usingPATH=/usr/bin:/bin
. I believedocker
is installed elsewhere.