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

Detailed explanation of js's event loop event queue in the browser

Table of contents Preface Understanding a stack a...

How to solve the problem that Docker container has no vim command

Find the problem Today, when I tried to modify th...

Solve the mysql user deletion bug

When the author was using MySQL to add a user, he...

MySQL Learning: Three Paradigms for Beginners

Table of contents 1. Paradigm foundation 1.1 The ...

Vue implements Modal component based on Teleport

Table of contents 1. Get to know Teleport 2. Basi...

How to change the terminal to a beautiful command line prompt in Ubuntu 18

I reinstalled VMware and Ubuntu, but the command ...

Summary of situations where MySQL indexes will not be used

Types of Indexes in MySQL Generally, they can be ...

Various front-end printing methods of web: CSS controls web page printing style

CSS controls the printing style of web pages : Use...

Steps to repair grub.cfg file corruption in Linux system

Table of contents 1. Introduction to grub.cfg fil...

Optimizing JavaScript and CSS to improve website performance

<br /> In the first and second parts, we int...

Solution to the problem of large font size on iPhone devices in wap pages

If you don't want to use javascript control, t...

JavaScript implements checkbox selection function

This article example shares the specific code of ...

How to convert Chinese into UTF-8 in HTML

In HTML, the Chinese phrase “學好好學” can be express...