How To Schedule Script In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Create a script with the desired command to run in your favorite text editor. For example, if you wanted to create a script that prints “Hello World”, type echo “Hello World“ >> myscript.sh
2. Make the script executable with the chmod command. For example, if your script was named myscript.sh, type chmod +x myscript.sh in the terminal.
3. The last step is to add the script to your crontab. Type crontab –e to open the crontab file in the nano text editor. Then, add a line at the bottom of the file with the command to run the script and the desired frequency of execution. For example, if you wanted the script to run every hour, you would add 0 * * * * /path/to/myscript.sh
4. Save your changes by typing Ctrl+X and then Y to confirm the save.