To schedule multiple jobs in a Unix-like environment, you can use the at command or cron jobs. Here’s a brief overview of both methods:
Using at Command
Install
at(if not already installed):sudo apt install atSchedule a Job: You can schedule a job to run at a specific time using the
atcommand. For example, to run a script at 2 PM:echo "bash /path/to/your/script.sh" | at 14:00List Scheduled Jobs: To see the jobs you have scheduled:
atqRemove a Scheduled Job: To remove a job, use:
atrm job_number
Using cron Jobs
Edit the Crontab: Open the crontab file for editing:
crontab -eAdd a Job: You can add jobs in the following format:
* * * * * /path/to/your/script.shThe five asterisks represent minute, hour, day of month, month, and day of week, respectively.
List Scheduled Cron Jobs: To view your scheduled cron jobs:
crontab -lRemove a Cron Job: Edit the crontab again and remove the line corresponding to the job you want to delete.
Example of a Cron Job
To run a script every day at 3 AM:
0 3 * * * /path/to/your/script.sh
Choose the method that best fits your scheduling needs!
