How to use crontab to add scheduled tasks in Linux

How to use crontab to add scheduled tasks in Linux

Preface

The Linux system is controlled by the system service crond. There are a lot of planned tasks on the Linux system, so this system service is started by default.

The crontab command is used to set instructions to be executed periodically. This command reads instructions from the standard input device and stores them in the "crontab" file for later reading and execution.

We can look at the status of the crond system service:


From here we can see that the crond service is self-starting (enabled) and running (active)

In addition, since users can set up scheduled tasks themselves, the Linux system also provides users with a command to control scheduled tasks: the crontab command.

crontab

Function: Add, query, and delete system scheduled tasks.

[root@localhost ~]# crontab [options]
Options:
-e: Edit crontab scheduled tasks
-l: Query crontab tasks
-r: Delete all crontab tasks of the current user 12345

[root@localhost ~]# crontab -e
#Enter the crontab editing interface. Will open vim to edit your work#Enter data, the basic format is:
* * * * * command12345

1.Format explanation:


Example:


2. Special Format

Example

3. Import from and export to files

#Import [root@localhost ~]# crontab filename
#Export [root@localhost ~]# crontab -l >filename1234

Example:

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of how to install Docker CE from a package under Linux
  • How to install and use Docker on Linux
  • Docker installation and configuration tutorial under Linux
  • Docker installation and usage tutorial under Linux
  • Detailed tutorial on how to install WordPress on Linux Docker
  • A simple method to implement Linux timed log deletion
  • Complete steps to build a squid proxy server in linux
  • Example explanation of alarm function in Linux
  • Simple steps to create a MySQL container with Docker
  • Install Docker on Linux (very simple installation method)

<<:  Common failures and reasons for mysql connection failure

>>:  Detailed explanation of the EXPLAIN command and its usage in MySQL

Recommend

Disable input text box input implementation properties

Today I want to summarize several very useful HTML...

Use of kubernetes YAML files

Table of contents 01 Introduction to YAML files Y...

An article teaches you JS function inheritance

Table of contents 1. Introduction: 2. Prototype c...

WeChat applet learning wxs usage tutorial

What is wxs? wxs (WeiXin Script) is a scripting l...

How to set up URL link in Nginx server

For websites with an architecture like LNMP, they...

React entry-level detailed notes

Table of contents 1. Basic understanding of React...

How to implement the observer pattern in JavaScript

Table of contents Overview Application scenarios ...

Implementation steps for building multi-page programs using Webpack

It is very common to use webpack to build single-...

Detailed explanation of CSS margin overlap and solution exploration

I recently reviewed some CSS-related knowledge po...

CSS3 flexible box flex to achieve three-column layout

As the title says: The height is known, the width...

The principle and direction of JavaScript this

How to determine what this points to? ①When calle...

How to publish a locally built docker image to dockerhub

Today we will introduce how to publish the local ...

Install and build a server environment of PHP+Apache+MySQL on CentOS

Yum (full name Yellow dog Updater, Modified) is a...