Reputation: 1
I'm trying to make my Amazon EC2 instances stop and start by a crontab. EC2 Api tools is succesfully installed. Manually it works.
The cron (which I put in with the command crontab -e): 10 * * * * ubuntu /usr/bin/ec2-stop-instances [instanceid] > /tmp/ec2.log
The file /tmp/ec2.log is created. When I use the command grep CRON /var/log/syslog I see the cron has actually run. I don't get any output in the /tmp/ec2.log file though. I have set all the amazon variables needed.
Even if I on purpose create a wrong cron, like this: 10 * * * * ubuntu /usr/bin/ec2-stop-instancwweqes [instanceid] > /tmp/ec2.log
I get no output in the file. Shouldn't there be an error? I also tried not defining the user: 10 * * * * /usr/bin/ec2-stop-instances [instanceid] > /tmp/ec2.log
And direct command: 10 * * * * ubuntu ec2-stop-instances [instanceid] > /tmp/ec2.log
Can someone please help me. If I can somehow debug, I can get to the solution.
Thanks in advance.
Upvotes: 0
Views: 120
Reputation: 3
Do a ps -ef | grep crond | grep -v grep and see if cron is running.
10 * * * * ubuntu /usr/bin/ec2-stop-instancwweqes [instanceid] 2> /tmp/ec2.log
Try this and see if error comes in ec2.log.
Upvotes: 0