Analysis and solution of the reasons why crontab scheduled tasks are not executed

Analysis and solution of the reasons why crontab scheduled tasks are not executed

Preface

The following are the ways to implement Linux scheduled tasks: cron, anacron, at, etc. cron is the service name, crond is the background process, and crontab is a customized scheduled task table.

However, I learned a lot today. I have been using crontab for so long and I just realized that I need to start it.

Added a scheduled task but it doesn't work well

[root@dev-gl-lh1 ApiAgent]# cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

# Cache coin mapping data */5 * * * * root /usr/bin/php /data/application/SwooleMoney/script/bin/cli.php CacheData cacheCoinMap

# Cache transaction pair information*/1 * * * * root /usr/bin/php /data/application/SwooleMoney/script/bin/cli.php CacheData cacheSymbol

# Delete depth data*/1 * * * * root /usr/bin/php /data/application/SwooleMoney/script/bin/cli.php CacheData clearExchangeDepths >/tmp/clearExchangeDepths.log
~          
~

The script is executed every minute, but the log is not displayed until the flowers are all gone.

# Check crontab status [root@dev-gl-lh1 ApiAgent]# /etc/init.d/crond status 
crond dead but pid file exists
# Start crontab service [root@dev-gl-lh1 ApiAgent]# /etc/init.d/crond start
Starting crond:

OK, the log output shows that the script was successfully executed, and I learned a lot.

Reference address: https://www.jb51.net/article/154290.htm

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. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM.

You may also be interested in:
  • Reasons why crontab scheduled tasks are not executed in Linux
  • Linux uses crontab to implement PHP execution plan timing tasks
  • How to use crontab to execute a scheduled task once a second in Linux
  • How to use Linux Crontab to execute PHP scripts regularly
  • Detailed explanation of using crontab to execute tasks regularly under CentOS 7
  • How to execute tasks regularly under Linux and instructions on how to use crontab (collected and sorted)
  • Detailed explanation of using Crontab command to execute PHP files regularly in Ubuntu system
  • Detailed explanation of at and crontab commands for scheduled execution of tasks in Linux
  • Detailed explanation of crontab scheduled execution command under Linux
  • Solution to Linux crontab timing execution of Shell scripts when specific commands need to be executed

<<:  Let's talk about my understanding and application of React Context

>>:  MySql index detailed introduction and correct use method

Recommend

Using css-loader to implement css module in vue-cli

【Foreword】 Both Vue and React's CSS modular s...

Div css naming standards css class naming rules (in line with SEO standards)

There are many tasks to be done in search engine o...

Website design should pay attention to the sense of color hierarchy

Recently I have been saying that design needs to h...

Mysql solution to improve the efficiency of copying large data tables

Preface This article mainly introduces the releva...

Detailed description of shallow copy and deep copy in js

Table of contents 1. js memory 2. Assignment 3. S...

A brief discussion on group by in MySQL

Table of contents 1. Introduction 2. Prepare the ...

js implements mouse in and out card switching content

This article shares the specific code of js to re...

What is em? Introduction and conversion method of em and px

What is em? em refers to the font height, and the ...

Collection of 12 practical web online tools

1. Favicon.cc To create ico icon websites online,...

Solution to the Multiple primary key defined error in MySQL

There are two ways to create a primary key: creat...

Create a custom system tray indicator for your tasks on Linux

System tray icons are still a magical feature tod...

Optimized implementation of count() for large MySQL tables

The following is my judgment based on the data st...

Detailed explanation of MySql slow query analysis and opening slow query log

I have also been researching MySQL performance op...

Detailed explanation of Linux one-line command to process batch files

Preface The best method may not be the one you ca...