Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
Was very busy lately working on a new project for a client. One of the key requirements in the project is to create a micro service to poll from external data sources for every two minutes, from 8am to 6pm, Monday to Friday and update the database with the latest data.
After testing out my Go program. I need to put in a crontab to start polling the data.
From the Linux Crontab configuration, the parameters are in such order :
MIN HOUR DOM MON DOW CMD
Explanation:
MIN - Minute field and can be 0 to 59
HOUR - Hour field and can be 0 to 23
DOM - Day of Month and can be 1-31
MON - Month field and can be 1-12
DOW - Day Of Week and can be 0-6
CMD - Comman to be executed.
Therefore, to achieve my objective, the final crontab configuration should look like this :
*/2 08-18 * * 1-5 /microservices/go-poll-and-update-summary-data
Hope this helps!
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+15.8k Golang : Convert date string to variants of time.Time type examples
+6.6k Golang : How to get ECDSA curve and parameters data?
+10.4k Golang : How to get a user home directory path?
+39.1k Golang : How to get struct field and value by name
+25.5k Golang : Copy directory - including sub-directories and files
+6.3k Golang : HTTP Routing with Goji example
+9.3k Golang : Activate web camera and broadcast out base64 encoded images
+34.6k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+6.2k Golang : Print how to use flag for your application example
+9.3k SSL : The certificate is not trusted because no issuer chain was provided
+3.7k PHP : Get client IP address
+7.9k CodeIgniter : Load different view for mobile devices