DEV Community

Dev Roy
Dev Roy

Posted on

Chapter-4 Cron Jobs With Shell Script

1 How to use cron jobs in ubuntu.

Go to your ubuntu server.

Step- #date >>>>>> Check your system current date and time.

Step-2#crontab -l >>>>>> Check which user set for cron job

Step-3#crontab -e >>>>>> Open Crontab file.

:--

Minutes Hour Day/Month Month Day/Week

12 9 * * *

echo "This is test cronfile" > /home/ubuntu/test.txt
Enter fullscreen mode Exit fullscreen mode

:--

Step-4#12 9 * * * echo "This is test cronJob" > /home/ubuntu/test.txt


2 How to run backup Shell script using Cron Job.

crontab -e >>>>> Open Crontab file.

  • * * * *bash /home/ubuntu/script/check_disk.sh >> /home/ubuntu/check.log.txt

Cat /home/ubuntu/check.log.txt

'*************************************************************************

Top comments (0)