AWS var spool cron

Mark Hayford
1 min readJul 16, 2018

--

TLDR: try sticking it in /var/spool/cron/{user name to run it}

So I spent 4 hours trying to figure out why my cron job didn’t work in AWS.

It was built by using ec2 user data. So I thought it was something in there.

I came across this gist. https://gist.github.com/imaifactory/5857793

And the second dudes response

So this stuff below worked —

User data — — copy script from s3 bucket then echo it into the var spool cron location

"aws s3 cp s3://<bucket and script here> /<dir to place script> \n",
"sudo echo '*/5 * * * * <command to run... like python /thisscript.py>' >> /var/spool/cron/root\n",
Could also do "sudo echo '*/5 * * * * <command to run... like python /thisscript.py>' >> /var/spool/cron/ec2-user or ubuntu or something like that\n",

And that was fun…

--

--

Mark Hayford
Mark Hayford

Written by Mark Hayford

A fuzzy life. Fuzzy computer problems. fuzzy Dog friends. fuzzy thoughts.

No responses yet