How to Schedule a Cron Job to run Scripts in Oracle Linux 8.5
To Schedule a Cron Job to run Scripts in Oracle Linux 8.5
Introduction:
The cron daemon is a long-running process that executes scheduled commands at specific dates and times, either as one-time events or as recurring tasks.
Installation Steps:
Step 1: Check the Version of Oracle Linux by using the below command
[root@linuxhelp linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"
Step 2: Create a file “ test.sh” script at 3:58 PM Add the following lines, Save and quit the file.
[root@linuxhelp linuxhelp]# vim test.sh
touch /home/linuxhelp/Downloads/file1.txt
mkdir /home/linuxhelp/Downloads/folder
Step 3: Grant Permission by using the below command
[root@linuxhelp linuxhelp]# chmod u+x test.sh
Step 4: Assign a Cron job and run the below command.
[root@linuxhelp]# crontab -e
00 04 11 Jun * /home/linuxhelp/test.sh
Step 5: Change Directory by using the below command
[root@linuxhelp linuxhelp]# cd Downloads
Step 6: List the Directory at 04:00PM , The Scheduled job to create file and Directory will be created as shown in the below image.
Step 7: To List the Scheduled jobs use the below command.
[root@linuxhelp]# crontab -l
00 04 11 Jun * /home/linuxhelp/test.sh
Step 8: To Remove the Scheduled jobs use the below command.
[root@linuxhelp]# crontab -r
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Schedule a Cron Job to run Scripts in Oracle Linux 8.5. Your feedback is much welcome.