### Linux Administration Practical Manual
### Linux Administration Practical Manual
To understand and configure the job scheduling utilities in Linux: cron, anacron, at, and
batch. These tools help automate the execution of scripts and commands at specified
times.
1. Cron Jobs
Cron is a time-based job scheduler in Unix-like operating systems that allows users to
schedule scripts or commands to run at specific intervals.
* * * * * /path/to/script.sh
code
crontab -l
2. Anacron
Anacron is used for running commands periodically, similar to cron, but it does not
require the system to be running continuously. This is useful for laptops or systems that
may not be powered on 24/7.
1. Edit the Anacrontab File: The configuration file is typically located at /etc/anacrontab.
Open it with:
2. bash
3. Copy code
4. sudo nano /etc/anacrontab
5. Define Anacron Jobs: The syntax is:
6. sql
code
`````bash
dailyjob /path/to/daily_script.sh
3. At Command
At allows you to schedule commands to run once at a specified time in the future.
code
bash
1. Remove a Scheduled Job
code
1. atrm job_number
4. Batch Utility
Batch schedules jobs to run when the system load levels permit. It is useful for running
jobs that can wait for a period of low system activity.
code
code
Check Scheduled Batch Jobs: Use the same atq command to see batch jobs.
Output Verification
To verify the successful configuration of cron, anacron, at, and batch, check their logs
and outputs:
1. Cron Logs: Check logs in /var/log/syslog or /var/log/cron.log (location may vary based on
distribution).
2. Anacron Logs: Check logs for anacron jobs in /var/log/syslog.
3. At and Batch Jobs: Check outputs of at and batch commands in the user's mail or the
log files.