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
+8.2k Golang : Changing a RGBA image number of channels with OpenCV
+25.3k PHP : Convert(cast) string to bigInt
+2.6k Java : Get FX sentiment from website example
+12.3k Golang : Query string with space symbol %20 in between
+6.4k Golang : Individual and total number of words counter example
+4.7k Unix/Linux : How to open tar.gz file ?
+4.8k Golang : Find change in a combination of coins example
+7.5k Linux/Unix : fatal: the Postfix mail system is already running
+21k Golang : How to read JPG(JPEG), GIF and PNG files ?
+4.7k Unix/Linux : Get reboot history or check when was the last reboot date
+8.5k Golang : How to check if a website is served via HTTPS
+17.7k Golang : Fix cannot download, $GOPATH not set error