#!/bin/bash
On the next lines, simply enter the commands you wish to be executed. Once you have made a script, you then usually want to then change the permissions so everything can execute it. For example, to give full read/write/execute permissions (which may not be appropriate in all situations), run the following command:
sudo chmod 777 /path/to/script
To have the script you have created executed at a regular interval, you can move it to one of the cron folders. These include /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly. For example, to have a script executed hourly, move it to cron.hourly with the following command:
sudo mv /path/to/script /etc/cron.hourly
Sources: Writing Shell Scripts
No comments:
Post a Comment