If you work in IT, scheduling different repetitive tasks are as part of your job, whereas automation processes may be necessary to avoid those.
And you’ll need something called a cron job if Linux is your operating system to make this happen.

What does cron mean?
Cron is a tool for scheduling jobs that can be found on Unix-like systems. The cron daemon runs in the background and makes your work effective. For the purpose of running predefined scripts, the cron reads the crontab (cron tables).
By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.

The cron utility uses the following schedule syntax in the configuration file:
* * * * * command to be executed
– – – – –
| | | | |
| | | | +—– day of week (0 – 6) (Sunday=0)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)
SCHEDULE SCHEDULED VALUE
5 0 * 7 * At 00:05 in July.
5 4 * * 6 At 04:05 on Saturday.
0 23 * * 1-5 At 23:00 on every day-of-week from Monday through Friday.
Now let’s see the script functionality how we are creating a directory and making a new script to save the ucs file.


Let’s save the simple command to execute ucs backup initiation.

Let’s run the script to verify if the command is okay. If your cron job isn’t working, please try running the script manually to ensure it executes properly.


To create a generic cron job to write the hostname and timestamp to /var/tmp/cron_output to test cron job execution:
- Edit the cron tab
# crontab -e
- Use i to insert changes
- Add the new line below after hostname and timestamp to write the cron job execution time to /var/tmp/cron_output:
* * * * * echo $HOSTNAME $(date) >> /var/tmp/cron_output
Note: This will create a cron job that executes every minute and writes out to /var/tmp/cron_output.
- Save changes, press ESC and type :wq!
- Now monitor /var/tmp/cron_output
# cat /var/tmp/cron_output
Once testing is complete, delete the newly added cron job task comment the line by adding ‘ #’ in front of the line to avoid filling up the file cron_output.
Now to make this testing we are executing it on the every hour:05 minutes as per the same changing the executable entry in “crontab -e”, we can check the output as well if it is saving ucs check the ucs stuff.



Below are two more examples for saving some commands using partitioning and in different files and in single file.
Netminion-script.sh
tmsh show ltm virtual /partition-1/VIP-name
tmsh list /ltm pool /partition-1/Pool-name
tmsh show sys clock
crontab -e
18,19,20 11-12 5 * * . /var/local/scripts/Netminion-script.sh > /var/local/scripts/pool-output_$(date +\%Y\%m\%d\%H\%M\%S).txt
To append the output in single file we can use double arrow like follows –
Netminion-script.sh
tmsh show ltm virtual /partition-1/VIP-name
tmsh list /ltm pool /partition-1/Pool-name
tmsh show sys clock
crontab -e
18,19,20 11-12 5 * * . /var/local/scripts/Netminion-script.sh >> /var/local/scripts/pool-output.txt
You may download the pdf from below link-Here
We also offer a diverse library of pre-recorded videos for any online training or buy self-paced courses.
“Get enrolled now”.
 Email:info@netminion.net, netminionsolutions@gmail.com
 Helpline: +91-9599857762(IN), + 19024124779 (CA)
 LinkedIn: https://www.linkedin.com/in/netminion-solutions/
 Website: https://netminion.net
 Videos Website: https://videos.netminion.in
Telegram Channel: https://t.me/NetMinionSolitionsOffical
 Buy a Rack Rental : https://labs.netminion.net/page/login/index.php
Keep Learning! Keep Growing! Keep investing!
Welcome to NetMinion Solutions, a leading education training institute/company to nurture minds and fostering a passion for learning. No matter if you are a beginner or a professional – our dedicated faculty and state-of-the-art facilities create an enriching environment where you can explore, innovate, and grow exponentially – academically and personally both.
We are committed to practical learning and provide cutting-edge lab solutions, to enhance your learning journey – including CCNA, CCNP & CCIE, data center, Wireless, Cloud, VMware, F5 -LTM, GTM, ASM, APM, Palo Alto, SD-WAN, Checkpoint, ACI and list goes on.
