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
+9.5k Golang : Sort and reverse sort a slice of integers
+6.8k Golang : Transform lisp or spinal case to Pascal case example
+6.2k Golang : Totalize or add-up an array or slice example
+16.2k Golang : File path independent of Operating System
+30.2k Golang : Download file example
+4.6k Linux : How to set root password in Linux Mint
+10.2k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+24.4k Golang : Daemonizing a simple web server process example
+5.5k CodeIgniter/PHP : Remove empty lines above RSS or ATOM xml tag
+7.8k Golang : Reverse text lines or flip line order example
+9.8k Golang : Text file editor (accept input from screen and save to file)
+3.7k Detect if Google Analytics and Developer Media are loaded properly or not