Bash

Automate scripts or .sh files

You can schedule your scripts (and your bash commands) to run automatically on your remote server every day, every hour, even every minute. 


For that, you'll have to use cron.
You can configure cron by opening crontab. Type this:

crontab -e 


It will open a text file which starts with a detailed manual of how it works. After the manual, you can add your actual tasks to schedule. 

One line is one task and you have to define 6 parameters in each line: The minute of the hour
The hour of the day
The day of the month

The month
The day of the week
The command you want to run. 


The first five parameters define the when - the 6th defines the what. 


Example:

01 00 * * * /home/demo_user/demo_script.sh
If you have this line in your crontab, it will run your demo_script.sh script (that's located in the /home/demo_user/ folder) every day, one minute after midnight.