From b161a8e64987d669890254d824f269a232ad772a Mon Sep 17 00:00:00 2001 From: Fascinated Date: Tue, 27 Jun 2023 09:32:19 +0100 Subject: [PATCH] add cronjobs to examples --- examples/cronjob.md | 62 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/examples/cronjob.md b/examples/cronjob.md index f9d790a..cf4bd1c 100644 --- a/examples/cronjob.md +++ b/examples/cronjob.md @@ -3,10 +3,66 @@ title: How to use cronjobs description: Examples on how to use cronjob to automate tasks published: true date: 2023-06-27T08:28:13.676Z -tags: +tags: editor: markdown dateCreated: 2023-06-27T08:28:13.676Z --- -# Header -Your content here \ No newline at end of file +# How to use cronjobs + +This guide provides examples on how to use cronjob to automate tasks. + +## Get Started + +- Begin by opening a terminal and running the following command: + +```bash +crontab -e +``` + +This command will open the crontab file in the nano text editor. + +- Next, you need to define the cronjob. Add the following lines to the file: + +```bash +* * * * * +``` + +- Finally, you can save the file by pressing `Ctrl + X` and then `Y`. + +## Syntax + +```bash +* <- minute (0-59) + * <- hour (0-23) + * <- day of month (1-31) + * <- month (1-12) + * <- day of week (0-6) (Sunday=0) + +``` + +## Examples + +### Run a command every minute + +```bash +* * * * * +``` + +### Run a command every 5 minutes + +```bash +*/5 * * * * +``` + +### Run a command every hour + +```bash +0 * * * * +``` + +### Run a command every day at midnight + +```bash +0 0 * * * +```