• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

atrm Command Examples in Linux

by admin

The at command is used to run a task once, at a specified time. It is not designed for repetitive or regularly scheduled tasks. The at command is very flexible. Users can specify a particular date and time, or cause the scheduled command to run after a given period of time. The command is typically used in an interactive manner, where the at command and time interval are specified, then a task is defined in an interactive prompt. This enables the user to enter a path to a script or a command to be run. Pressing Ctrl+D exits the interactive mode.

Removing scheduled tasks

It’s nice to have the ability to schedule jobs to be run using the at utility. However, we need some form of control over the jobs scheduled. If we’ve decided to cancel a job, we can use the atrm command. The atrm command is used for canceling a job before it is executed by the at utility. For instance, we schedule a reboot using the at utility:

# at now + 5 minutes
warning: commands will be executed using /bin/sh
at> reboot
at> [EOT]
job 8 at Thu Sep  6 10:06:00 2018

# date
Thu Sep  6 10:01:21 EDT 2018

Based on the preceding command, we have specified to reboot the system in five minutes using the at command. Now, if for some reason we want to cancel this job, we can use the atrm command. We can do this as follows:

# atq
4              Mon Sep 10 09:11:00 2018 a root
8              Thu Sep  6 10:06:00 2018 a root
7              Sun Sep  6 09:25:00 2043 a root

# atrm 8

# atq
4              Mon Sep 10 09:11:00 2018 a root
7              Sun Sep  6 09:25:00 2043 a root

Based on the preceding command, we used the atq command to list the scheduled jobs; we then used the atrm command and specified the job ID to remove it.

atrm Command Examples

1. Remove job number 10:

# atrm 10

2. Remove many jobs, separated by spaces:

# atrm 15 17 22

Filed Under: Linux

Some more articles you might also be interested in …

  1. runuser: command not found
  2. ansible-playbook – Execute tasks defined in playbook on remote machines over SSH
  3. Configuring sudo to Enable Commands for Non-Root Users in Linux
  4. tune2fs: command not found
  5. acpi Command Examples in Linux
  6. How to Disable RSH Server in CentOS/RHEL
  7. mktemp: command not found
  8. How To Configure Restricted Bash Shell in Linux
  9. apt Command Examples in Linux
  10. Linux OS Service ‘nscd’

You May Also Like

Primary Sidebar

Recent Posts

  • “aws s3 mv” Command Examples
  • “aws s3 mb” Command Examples
  • “aws s3 ls” Command Examples
  • “aws s3 cp” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright