Friday, December 9, 2016

how to create a cron job that runs on the first day of month




There are fields on my server's control panel like this



Minute - Hour - Day of month - Month - Day of the week - Command



How can I create a cron job runs on first day of the month with this fields?


Answer



This will run the command foo at 12:00AM on the first of every month



0 0 1 * * /usr/bin/foo



This article describes the various fields, look to the bottom of the page: http://en.wikipedia.org/wiki/Cron



To add this to your cron file, just use the command



crontab -e

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...