0
0
Linux CLIscripting~15 mins

at command for one-time jobs in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Schedule a One-Time Job Using the at Command
📖 Scenario: You want to run a simple task on your Linux system just once at a specific time. For example, you want to display a message after 1 minute.
🎯 Goal: Learn how to use the at command to schedule a one-time job that runs a command at a specified time.
📋 What You'll Learn
Create a file with a command to run
Schedule the command to run using at
Verify the scheduled job
Check the output of the job
💡 Why This Matters
🌍 Real World
System administrators often need to run tasks once at a specific time, like backups or notifications.
💼 Career
Knowing how to use the <code>at</code> command is useful for automating one-time maintenance or alert tasks in Linux environments.
Progress0 / 4 steps
1
Create a file with the command to run
Create a file called message.sh that contains the command echo "Hello from at command!" > ~/at_output.txt.
Linux CLI
Need a hint?

Use echo with redirection > to create the file.

2
Schedule the command to run using at
Schedule the script message.sh to run 1 minute from now using the at command. Use at now + 1 minute and provide the command bash ~/message.sh to at.
Linux CLI
Need a hint?

Use a here document << EOF to pass commands to at.

3
Verify the scheduled job
Use the atq command to list the scheduled jobs and confirm your job is queued.
Linux CLI
Need a hint?

Just type atq to see the queue of jobs.

4
Check the output of the job
After 1 minute, use cat ~/at_output.txt to display the message written by the scheduled job.
Linux CLI
Need a hint?

Use cat ~/at_output.txt to see the message.