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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. gsettings Command Examples in Linux
  2. cpio: command not found
  3. pacstrap Command Examples in Linux
  4. pluma: command not found
  5. at Command Examples in Linux
  6. findfs Command Examples in Linux
  7. RedHat / CentOS : How to change currently active slave interface of bonding online
  8. “git effort” Command Examples
  9. firewall-cmd Command Examples in Linux
  10. ghcup: Haskell toolchain installer

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright