Do you have a script you would like to run after logging in to your Linux system? Would you like the script to run automatically after the other parts of your system have started properly? What can you do to start a script one minute after you have logged on to your system?
It is very easy to use the crontab function. The first thing you need is the script that you would like to run. Imagine that you have a script that you want to copy all files from your home directory to a backup directory after you have rebooted your system. You can achieve this by using the following command.
Run a script 60 seconds after rebooting using Crontab.
Run the following command to launch crontab.
crontab -e
Now you can add the following line. Make sure to change the path to the script.
@reboot sleep 60 && /home/ipguide/backupscript.sh
This command tells the command to sleep for 60 seconds, and then it will run the script in the above path. That’s it. Your command will run with a 60-second delay. As you probably understand, you can change the number of seconds for the delay, meaning that you can make the waiting time longer and shorter depending on your goal.
You can also use the following time settings to run scripts at special times using Crontab.
@yearly
@weekly
@annually
@daily
@hourly