Linux

Ubuntu auto run shell script code

Ubuntu auto run shell script code





Ubuntu auto run shell script code
Ubuntu auto run shell script code

You know we can limit Ubuntu system to run script code.sh by itself, but you need to set date and check code in crontab. It’s time of date that you limit in crontab, it will run code which you limit by itself.
Below is an example to show and you can use by create code script.sh for back up my site data which name www-backup.sh.

  1. The first you need create this code #how to auto back up data all website mysql database and file data website.
  2. And then take address of that code to pass in the crontap for run code mysqlbackup.sh by automatic.

Ubuntu auto run shell script code

$ sudo nano /etc/crontab

or

# nano /etc/crontab

Ubuntu auto run shell script code
Ubuntu auto run shell script code on crontap

​​​​​​​​​​​​​​m h dom mon dow user command 15 18 * * * root /scripts/www-backup.sh
Note: In order to run code to process by itself in crontap you need to know number 15 which we use is minute and 18 is hour, if you want to it to run code two times per day or month or year so you need to delete sign of *** and replace by number.

Conclusion
We hope that this strategy will help readers to limited for Ubuntu system run code script.sh by itself.

Leave a Reply

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

Most Popular

To Top