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.

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

Cat /home/ubuntu/check.log.txt

‘*************************************************************************


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Free & easy ad network.