at
The at
command is a powerful tool used to schedule commands or shell scripts to run at a later time. It allows users to submit jobs to be executed at a specific date and hour, making it useful for tasks that require delayed execution.
Use Cases:
- Scheduling system maintenance or backups
- Running tasks during off-peak hours
- Executing scripts or commands when the system is less busy
Syntax:
bash
at [options] time
Example: at 23:00 tomorrow
will schedule a job to run at 11 PM the next day.
Options:
-V
: Display version information and exit-q queue
: Specify the queue where the job should be placed (default is system’s default queue)
Hacks:
- Use the
@
symbol instead of specifying a time:at now + 1 minute
will execute a command one minute from now. - To schedule a recurring task, use the
echo "command"
| at [time]syntax. For example, to run a backup script every Sunday at 2 AM, use
echo „backup_script.sh“ | at 02:00 sun`. - Combine
at
with other commands or scripts using pipes and redirection.
Experience Level:
This command is suitable for intermediate users who need to manage system resources or automate tasks. Beginners may find it useful after gaining some experience with basic shell commands and scheduling tools like cron. Advanced users can use the at
command in combination with more complex techniques, such as job control and process management.