I have a simple shell script to run a docker command below, which works just fine if I ran it manually. However it didn't work if I ran it by cron. I didn't see any logging in /var/log/cron
..
And I tested cron by creating a simple script to touch a file, and it worked fine. Cron doesn't work with docker?
cat start.sh
#!/bin/bash
docker run --shm-size 2g --rm --net sitespeedio_default \
-v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:24.6.0\
--pageCompleteWaitTime 30000 \
lex-login.js lex-view_call_call_only.js -n 1 \
--influxdb.host influxdb \
--influxdb.username $INFLUX_U \
--influxdb.password $INFLUX_P --spa --multi
crontab -l
2 * * * * /home/ec2-user/start.sh >/dev/null 2>&1
CodePudding user response:
Update the crontab
content to:
2 * * * * /bin/bash /home/ec2-user/start.sh >/dev/null 2>&1
And then, make sure that the crontab
's user has the permission to run this script.