There are times when there’s a need for running a group of tasks automatically at certain times in the future. These tasks are usually administrative, but could be anything – from making database backups to downloading emails when everyone is asleep.

有时候,将来有必要在某些时候自动运行一组任务。 这些任务通常是管理性的,但可能是任何事情–从进行数据库备份到每个人都睡着时下载电子邮件。

Cron is a time-based job scheduler in Unix-like operating systems, which triggers certain tasks at a point in the future. The name originates from the Greek word χρόνος (chronos), which means time.

Cron是类Unix操作系统中的基于时间的作业调度程序,它将在将来的某个时刻触发某些任务。 名称源自希腊语χρόνος (chronos),意思是时间。

The most commonly used version of Cron is known as Vixie Cron, originally developed by Paul Vixie in 1987.

最常用的Cron版本称为Vixie Cron,最初由Paul Vixie于1987年开发。

This article is an in-depth walkthrough of this program, and a reboot of this ancient, but still surprisingly relevant post.

本文是该程序的深入演练,也是该古老但仍然出乎意料的相关文章的重新启动。

Chronos Image

术语 (Terminology)

  • Job: a unit of work, a series of steps to do something. For example, sending an email to a group of users. In this article, we’ll use task, job, cron job or event interchangeably.

    工作:一个工作单元,一系列要做某事的步骤。 例如,向一组用户发送电子邮件。 在本文中,我们将交替使用taskjobcron jobevent

  • Daemon: (/ˈdiːmən/ or /ˈdeɪmən/) is a computer program which runs in the background, serving different purposes. Daemons are often started at boot time. A web server is a daemon serving HTTP requests. Cron is a daemon for running scheduled tasks.

    守护程序: (/ ˈdiːmən /或/ ˈdeɪmən /)是在后台运行的计算机程序,可用于不同目的。 守护程序通常在引导时启动。 Web服务器是服务于HTTP请求的守护程序。 Cron是用于运行计划任务的守护程序。

  • Cron Job: a cron job is a scheduled job, being run by Cron when it’s due.

    Cron作业: cron作业是计划的作业 ,在到期时由Cron运行。

  • Webcron: a time-based job scheduler which runs within the web server environment. It’s used as an alternative to the standard Cron, often on shared web hosts that do not provide shell access.

    Webcron:在Web服务器环境中运行的基于时间的作业计划程序。 它通常用作标准Cron的替代品,通常在不提供外壳程序访问权限的共享Web主机上使用。

入门 (Getting Started)

This tutorial assumes you’re running a Unix-based operating system like Ubuntu. If you aren’t, we recommend setting up Homestead Improved – it’s a 5 minute process which will save you years down the line.

本教程假定您正在运行基于Ubuntu的基于Unix的操作系统。 如果不是这样,我们建议您设置Homestead Improvement –这是一个5分钟的过程,可以节省您数年的时间。

If we take a look inside the /etc directory, we can see directories like cron.hourly, cron.daily, cron.weekly and cron.monthly, each corresponding to a certain frequency of execution. One way to schedule our tasks is to place our scripts in the proper directory. For example, to run db_backup.php on a daily basis, we put it inside cron.daily. If the folder for a given frequency is missing, we would need to create it first.

如果在/etc目录中查看,我们会看到cron.hourlycron.dailycron.weeklycron.monthly /etc目录,每个目录都对应于一定的执行频率。 安排任务的一种方法是将脚本放置在正确的目录中。 例如,要每天运行db_backup.php ,请将其放入cron.daily 。 如果缺少给定频率的文件夹,则需要首先创建它。

Note: This approach uses the run-parts script, a command which runs every executable it finds within the specified directory.

注意:此方法使用run-parts脚本,该命令运行在指定目录中找到的每个可执行文件。

This is the simplest way to schedule a task. However, if we need more flexibility, we should use Crontab.

这是安排任务的最简单方法。 但是,如果需要更大的灵活性,则应使用Crontab。

Crontab文件 (Crontab Files)

Cron uses special configuration files called crontab files, which contain a list of jobs to be done. Crontab stands for Cron Table. Each line in the crontab file is called a cron job, which resembles a set of columns separated by a space character. Each row specifies when and how often a certain command or script should be executed.

Cron使用称为crontab文件的特殊配置文件,其中包含要完成的作业列表。 Crontab代表Cron Table 。 crontab文件中的每一行都称为cron作业,它类似于一组由空格分隔的列。 每行指定应在何时以及多久执行一次特定命令或脚本。

In a crontab file, blank lines or lines starting with #, spaces or tabs will be ignored. Lines starting with # are considered comments.

在crontab文件中,空白行或以#开头的行,空格或制表符将被忽略。 以#开头的行被视为注释。

Active lines in a crontab are either the declaration of an environment variable or a cron job, and comments are not allowed on the active lines.

crontab中的活动行是环境变量的声明或cron作业,并且活动行中不允许注释。

Below is an example of a crontab file with just one entry:

以下是仅包含一个条目的crontab文件的示例:

0 0 * * *  /var/www/sites/db_backup.sh

The first part 0 0 * * * is the cron expression, which specifies the frequency of execution. The above cron job will run once a day.

第一部分0 0 * * *是cron表达式,它指定执行频率。 上面的cron作业每天运行一次。

Users can have their own crontab files named after their username as registered in the /etc/passwd file. All user-level crontab files reside in Cron’s spool area. These files should not be edited directly. Instead, we should edit them using the crontab command-line utility.

用户可以使用在/etc/passwd文件中注册的用户名命名自己的crontab文件。 所有用户级crontab文件都位于Cron的假脱机区域中。 这些文件应该被直接编辑。 相反,我们应该使用crontab命令行实用工具对其进行编辑。

Note: The spool directory varies across different distributions of Linux. On Ubuntu it’s /var/spool/cron/crontabs while in CentOS it’s /var/spool/cron.

注意:假脱机目录在Linux的不同发行版中有所不同。 在Ubuntu上是/var/spool/cron/crontabs而在CentOS中是/var/spool/cron

To edit our own crontab file:

要编辑我们自己的 crontab文件:

crontab -e

The above command will automatically open up the crontab file which belongs to our user. If a default system editor for the crontab hasn’t been selected before, a choice will be presented listing the installed ones. We can also explicitly choose or change our desired editor for editing the crontab file:

上面的命令将自动打开属于我们用户的crontab文件。 如果以前没有为crontab选择默认的系统编辑器,则会显示一个选项,列出已安装的程序。 我们还可以显式选择或更改所需的编辑器来编辑crontab文件:

export VISUAL=nano; crontab -e

After we save the file and exit the editor, the crontab will be checked for accuracy. If everything is set properly, the file will be saved to the spool directory.

保存文件并退出编辑器后,将检查crontab的准确性。 如果一切设置正确,文件将保存到假脱机目录。

Note: Each command in the crontab file is executed from the perspective of the user who owns the crontab, so if your command runs as root (sudo) you will not be able to define this crontab from your own user account unless you log in as root.

注意: crontab文件中的每个命令都是从拥有crontab的用户的角度执行的,因此,如果您以root(sudo)身份运行命令,则除非您以根。

To list the installed cron jobs belonging to our own user:

列出属于我们自己用户的已安装cron作业:

crontab -l

We can also write our cron jobs in a file and send its contents to the crontab file like so:

我们还可以将cron作业写入文件中,然后将其内容发送到crontab文件中,如下所示:

crontab /path/to/the/file/containing/cronjobs.txt

The preceding command will overwrite the existing crontab file with /path/to/the/file/containing/cronjobs.txt.

前面的命令将使用/path/to/the/file/containing/cronjobs.txt the /path/to/the/file/containing/cronjobs.txt file /path/to/the/file/containing/cronjobs.txt覆盖现有的crontab文件。

To remove the crontab, we use the -r option:

要删除crontab,我们使用-r选项:

crontab -r

Crontab条目的剖析 (Anatomy of a Crontab Entry)

The anatomy of a user-level crontab entry looks like the following:

用户级crontab条目的结构如下所示:

# ┌───────────── min (0 - 59) 
# │ ┌────────────── hour (0 - 23)
# │ │ ┌─────────────── day of month (1 - 31)
# │ │ │ ┌──────────────── month (1 - 12)
# │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ │ │
# │ │ │ │ │
# * * * * *  command to execute

The first two fields specify the time (minute and hour) at which the task will run. The next two fields specify the day of the month and the month. The fifth field specifies the day of the week.

前两个字段指定任务运行的时间( 分钟小时 )。 接下来的两个字段指定当月的日期月份 。 第五个字段指定星期几

The command will be executed when the minute, hour, month and either day of month or day of week match the current time.

当分钟,小时,月份以及月份中的某天一周中的某天与当前时间匹配时,将执行该命令。

If both day of week and day of month have certain values, the event will be run when either field matches the current time. Consider the following expression:

如果星期几月份中的某几天都具有特定值,则任一字段与当前时间匹配时将运行事件。 考虑以下表达式:

0 0 5-20/5 Feb 2 /path/to/command

The preceding cron job will run once per day every five days, from 5th to 20th of February plus all Tuesdays of February.

2月5日至20日加上 2月的所有星期二,之前的cron作业将每5天每天运行一次。

Important: When both day of month and day of week have certain values (not an asterisk), it will create an OR condition, meaning both days will be matched.

重要说明 :当月份中的 某天和一周中的某天都具有特定值(而不是星号)时,它将创建OR条件,这意味着这两天将匹配。

The syntax in system crontabs (/etc/crontab) is slightly different than user-level crontabs. The difference is that the sixth field is not the command, but it is the user we want to run the job as.

系统crontabs( /etc/crontab )中的语法与用户级crontabs略有不同。 区别在于第六个字段不是命令,而是我们要以其身份运行作业的用户

* * * * * testuser /path/to/command

It’s not recommended to put system-wide cron jobs in /etc/crontab, as this file might be modified in future system updates. Instead, we put these cron jobs in the /etc/cron.d directory.

不建议将系统范围的cron作业放在/etc/crontab ,因为此文件可能在以后的系统更新中被修改。 相反,我们将这些cron作业放在/etc/cron.d目录中。

编辑其他用户的Crontab (Editing Other Users’ Crontab)

We might need to edit other users’ crontab files. To do this, we use the -u option as below:

我们可能需要编辑其他用户的crontab文件。 为此,我们使用-u选项,如下所示:

crontab -u username -e

Note We can only edit other users’ crontab files as the root user, or as a user with administrative privileges.

注意我们只能以root用户或具有管理特权的用户身份编辑其他用户的crontab文件。

Some tasks require super admin privileges, thus, they should be added to the root user’s crontab file:

一些任务需要超级管理员特权,因此,应将它们添加到root用户的crontab文件中:

sudo crontab -e

Note: Please note that using sudo with crontab -e will edit the root user’s crontab file. If we need to to edit another user’s crontab while using sudo, we should use -u option to specify the crontab owner.

注意:请注意,将sudocrontab -e一起使用将编辑root用户的crontab文件。 如果在使用sudo需要编辑其他用户的crontab,则应使用-u选项指定crontab所有者。

To learn more about the crontab command:

要了解有关crontab命令的更多信息:

man crontab

标准和非标准值 (Standard and Non-Standard Values)

Crontab fields accept numbers as values. However, we can put other data structures in these fields, as well.

Crontab字段接受数字作为值。 但是,我们也可以在这些字段中放置其他数据结构。

范围 (Ranges)

We can pass in ranges of numbers:

我们可以传递数字范围:

0 6-18 1-15 * * /path/to/command

The above cron job will be executed from 6 am to 6 pm from 1st to 15th of each month in the year. Note that the specified range is inclusive, so 1-5 means 1,2,3,4,5.

上面的Cron工作将从每年的每月1号到15号从上午6点到下午6点执行。 请注意,指定的范围是包括在内的,因此1-5表示1,2,3,4,5。

清单 (Lists)

A list is a group of values separated by commas. We can have lists as field values:

列表是一组用逗号分隔的值。 我们可以将列表作为字段值:

0 1,4,5,7 * * * /path/to/command

The above syntax will run the cron job at 1 am, 4 am, 5 am and 7 am every day.

以上语法将在每天的凌晨1点,4点,5点和7点运行cron作业。

脚步 (Steps)

Steps can be used with ranges or the asterisk character (*). When they are used with ranges they specify the number of values to skip through the end of the range. They are defined with a / character after the range, followed by a number. Consider the following syntax:

步骤可以与范围或星号(*) 。 与范围一起使用时,它们指定要跳过范围末尾的值的数量。 它们在范围后用/字符定义,后跟数字。 考虑以下语法:

0 6-18/2 * * * /path/to/command

The above cron job will be executed every two hours from 6 am to 6 pm.

上述cron作业将从上午6点至下午6点每两个小时执行一次。

When steps are used with an asterisk, they simply specify the frequency of that particular field. As an example if we set the minute to */5, it simply means every five minutes.

当步骤与星号一起使用时,它们仅指定该特定字段的频率。 例如,如果将分钟设置为*/5 ,则表示每五分钟一次

We can combine lists, ranges, and steps together to have more flexible event scheduling:

我们可以将列表,范围和步骤组合在一起,以进行更灵活的事件调度:

0 0-10/5,14,15,18-23/3 1 1 * /path/to/command

The above event will run every five hours from midnight of January 1st to 10 am, 2 pm, 3 pm and also every three hours from 6pm to 11 pm.

上述活动从1月1日午夜至上午10点,下午2点,下午3点每五小时运行一次,从下午6点至晚上11点每三小时运行一次。

名字 (Names)

For the fields month and day of week we can use the first three letters of a particular day or month, like Sat, sun, Feb, Sep, etc.

对于月份星期几,我们可以使用特定日期或月份的前三个字母,例如SatsunFebSep等。

* * * Feb,mar sat,sun /path/to/command

The preceding cron job will be run only on Saturdays and Sundays of February and March.

之前的cron作业将仅在2月和3月的周六和周日运行。

Please note that the names are not case-sensitive. Ranges are not allowed when using names.

请注意,名称区分大小写。 使用名称时不允许使用范围。

预定义的定义 (Predefined Definitions)

Some cron implementations may support some special strings. These strings are used instead of the first five fields, each specifying a certain frequency:

一些cron实现可能支持一些特殊的字符串。 使用这些字符串代替前五个字段,每个字段指定特定的频率:

  • @yearly, @annually Run once a year at midnight of January 1 (0 0 1 1 *)

    @ yearly,@ annualally每年1月1日午夜运行一次(0 0 1 1 *)

  • @monthly Run once a month, at midnight of the first day of the month (0 0 1 * *)

    @monthly每月一次,在每月第一天的午夜运行(0 0 1 * *)

  • @weekly Run once a week at midnight of Sunday (0 0 * * 0)

    @weekly在星期日的午夜每周运行一次(0 0 * * 0)

  • @daily Run once a day at midnight (0 0 * * *)

    @daily每天午夜运行一次(0 0 * * *)

  • @hourly Run at the beginning of every hour (0 * * * *)

    @hourly在每小时开始时运行(0 * * * *)

  • @reboot Run once at startup

    @reboot在启动时运行一次

同一Cron作业中的多个命令 (Multiple Commands in the Same Cron Job)

We can run several commands in the same cron job by separating them with a semi-colon (;).

我们可以在同一cron作业中运行多个命令,方法是使用分号( ; )将它们分开。

* * * * * /path/to/command-1; /path/to/command-2

If the running commands depend on each other, we can use double ampersand (&&) between them. As a result, the second command will not be executed if the first one fails.

如果运行命令互相依赖,我们可以使用双和号(&&)之间。 结果,如果第一个命令失败,则第二个命令将不会执行。

* * * * * /path/to/command-1 && /path/to/command-2

环境变量 (Environment Variables)

Environment variables in crontab files are in the form of VARIABLE_NAME = VALUE (The white spaces around the equal sign are optional). Cron does not source any startup files from the user’s home directory (when it’s running user-level crons). This means we should manually set any user-specific settings required by our tasks.

crontab文件中的环境变量采用VARIABLE_NAME = VALUE的形式(等号周围的空白是可选的)。 Cron不会从用户的主目录中获取任何启动文件(运行用户级Cron时)。 这意味着我们应该手动设置任务所需的任何特定于用户的设置。

Cron daemon automatically sets some environmental variables when it starts. HOME and LOGNAME are set from the crontab owner’s information in /etc/passwd. However, we can override these values in our crontab file if there’s a need for this.

Cron守护程序在启动时会自动设置一些环境变量。 HOMELOGNAME是从/etc/passwd的crontab所有者的信息中设置的。 但是,如果需要,我们可以在crontab文件中覆盖这些值。

There are also a few more variables like SHELL, specifying the shell which runs the commands. It is /bin/sh by default. We can also set the PATH in which to look for programs.

还有其他一些变量,例如SHELL ,用于指定运行命令的外壳。 默认情况下是/bin/sh 。 我们还可以设置要在其中查找程序的PATH

PATH = /usr/bin;/usr/local/bin

Important: We should wrap the value in quotation marks when there’s a space in the value. Please note that values are considered as ordinary strings and are not interpreted or parsed in any way.

重要提示 :如果值中有空格,则应将其用引号引起来。 请注意,值被视为普通字符串, 不会以任何方式解释或解析。

不同时区 (Different Time Zones)

Cron uses the system’s time zone setting when evaluating crontab entries. This might cause problems for multiuser systems with users based in different time zones. To work around this problem, we can add an environment variable named CRON_TZ in our crontab file. As a result, all crontab entries will be parsed based on the specified timezone.

Cron在评估crontab条目时使用系统的时区设置。 对于具有不同时区用户的多用户系统,这可能会导致问题。 要变通解决此问题,我们可以在crontab文件中添加一个名为CRON_TZ的环境变量。 结果,将基于指定的时区解析所有crontab条目。

Cron如何解释Crontab文件 (How Cron Interprets Crontab Files)

After Cron starts, it searches its spool area to find and load crontab files into the memory. It additionally checks the /etc/crontab and or /etc/cron.d directories for system crontabs.

Cron启动后,它将搜索其后台打印区域以查找crontab文件并将其加载到内存中。 此外,它还会检查/etc/crontab/etc/crontab/etc/cron.d目录中的系统crontab。

After loading the crontabs into memory, Cron checks the loaded crontabs on a minute-by-minute basis, running the events which are due.

将crontabs加载到内存中后,Cron会每分钟检查加载的crontabs,并运行到期的事件。

In addition to this, Cron regularly (every minute) checks if the spool directory’s modtime (modification time) has changed. If so, it checks the modetime of all the loaded crontabs and reloads those which have changed. That’s why we don’t have to restart the daemon when installing a new cron job.

除此之外,Cron会定期(每分钟)检查假脱机目录的modtime (修改时间)是否已更改。 如果是这样,它将检查所有已加载crontab的modetime并重新加载已更改的crontab。 这就是为什么在安装新的cron作业时我们不必重新启动守护程序。

Cron权限 (Cron Permissions)

We can specify which user should be able to use Cron and which user should not. There are two files which play an important role when it comes to cron permissions: /etc/cron.allow and /etc/cron.deny.

我们可以指定哪个用户应该可以使用Cron,哪个用户不能。 在涉及cron权限时,有两个文件起着重要作用: /etc/cron.allow/etc/cron.deny

If /etc/cron.allow exists, then our username must be listed in this file in order to use crontab. If /etc/cron.deny exists, it shouldn’t contain our username. If neither of these files exist, then based on the site-dependent configuration parameters, either the super user or all users will be able to use crontab command. For example, in Ubuntu, if neither file exists, all users can use crontab by default.

如果存在/etc/cron.allow ,则必须在此文件中列出我们的用户名才能使用crontab 。 如果/etc/cron.deny存在,则不应包含我们的用户名。 如果这两个文件都不存在,则基于站点的配置参数, 超级用户所有用户都将能够使用crontab命令。 例如,在Ubuntu中,如果两个文件都不存在,则默认情况下所有用户都可以使用crontab。

We can put ALL in /etc/cron.deny file to prevent all users from using cron:

我们可以将ALL放在/etc/cron.deny文件中,以防止所有用户使用cron:

echo ALL > /etc/cron.deny

Note: If we create an /etc/cron.allow file, there’s no need to create a /etc/cron.deny file as it has the same effect as creating a /etc/cron.deny file with ALL in it.

注意 :如果我们创建/etc/cron.allow文件,则无需创建/etc/cron.deny文件,因为它与创建包含ALL/etc/cron.deny文件具有相同的效果。

重定向输出 (Redirecting Output)

We can redirect the output of our cron job to a file, if the command (or script) has any output:

如果命令(或脚本)具有任何输出,我们可以将cron作业的输出重定向到文件:

* * * * * /path/to/php /path/to/the/command >> /var/log/cron.log

We can redirect the standard output to dev null, to get no email (more on emails below), but still allowing the standard error to be sent as email:

我们可以将标准输出重定向到dev null,以不接收电子邮件(更多有关以下电子邮件),但仍允许将标准错误作为电子邮件发送:

* * * * * /path/to/php /path/to/the/command > /dev/null

To prevent Cron from sending any emails to us, we change the respective crontab entry as below:

为防止Cron向我们发送任何电子邮件,我们如下更改相应的crontab条目:

* * * * * /path/to/php /path/to/the/command > /dev/null 2>&1

This means “send both the standard output, and the error output into oblivion”.

这意味着“同时发送标准输出和错误输出”。

通过电子邮件发送输出 (Email the Output)

The output is mailed to the owner of the crontab or the email(s) specified in the MAILTO environment variable (if the standard output or standard error are not redirected as above).

输出将邮寄给crontab的所有者或MAILTO环境变量中指定的电子邮件(如果标准输出或标准错误未如上述那样重定向)。

If MAILTO is set to empty, no email will be sent out as the result of the cron job.

如果MAILTO设置为空,则cron作业不会发送任何电子邮件。

We can set several emails by separating them with commas:

我们可以使用逗号分隔多个电子邮件:

MAILTO=admin@example.com,dev@example.com
* * * * * /path/to/command

Cron和PHP (Cron and PHP)

We usually run our PHP command line scripts using the PHP executable.

我们通常使用PHP可执行文件运行PHP命令行脚本。

php script.php

Alternatively, we can use shebang at the beginning of the script, and point to the PHP executable:

另外,我们可以在脚本的开头使用shebang ,然后指向PHP可执行文件:

#! /usr/bin/php
<?php
// PHP code here

As a result, we can execute the file by calling it by name. However, we need to make sure we have the permission to execute it.

结果,我们可以通过按名称调用文件来执行该文件。 但是,我们需要确保我们具有执行它的权限。

To have more robust PHP command line scripts, we can use third-party components for creating console applications like Symfony Console Component or Laravel Artisan. This article is a good start for using Symfony’s Console Component. Creating console commands using Laravel Artisan has been also covered here. If you’d rather use another command line tool for PHP, we have a comparison here.

为了拥有更强大PHP命令行脚本,我们可以使用第三方组件来创建控制台应用程序,例如Symfony Console Component或Laravel Artisan 。 本文是使用Symfony的控制台组件的一个良好的开端。 这里也介绍了使用Laravel Artisan创建控制台命令。 如果您想为PHP使用其他命令行工具,请在此处进行比较。

任务重叠 (Task Overlaps)

There are times when scheduled tasks take much longer than expected. This will cause overlaps, meaning some tasks might be running at the same time. This might not cause a problem in some cases, but when they are modifying the same data in a database, we’ll have a problem. We can overcome this by increasing the execution frequency of the tasks, but still it’s not guaranteed that these overlaps won’t happen again.

有时,计划任务要花费比预期更长的时间。 这将导致重叠,这意味着某些任务可能同时运行。 在某些情况下,这可能不会引起问题,但是当他们修改数据库中的相同数据时,我们会遇到问题。 我们可以通过增加任务的执行频率来克服这一问题,但是仍然不能保证这些重叠不会再次发生。

We have several options to prevent cron jobs from overlapping.

我们有几种选择可以防止cron作业重叠。

使用羊群 (Using Flock)

Flock is a nice tool to manage lock files from within shell scripts or the command line. These lock files are useful for knowing whether or not a script is running.

Flock是一个很好的工具,可以从Shell脚本或命令行中管理锁文件。 这些锁定文件对于了解脚本是否正在运行很有用。

When used in conjunction with Cron, the respective cron jobs do not start if the lock file exists. You can install Flock using apt-get or yum depending on the Linux distribution.

与Cron结合使用时,如果存在锁定文件,则相应的cron作业不会启动。 您可以根据Linux发行版使用apt-getyum安装Flock。

apt-get install flock

Or

要么

yum install flock

Consider the following crontab entry:

考虑以下crontab条目:

* * * * * /usr/bin/flock --timeout=1 /path/to/cron.lock /usr/bin/php /path/to/scripts.php

In the preceding example, flock looks for /path/to/cron.lock. If the lock is acquired in one second, it will run the script, otherwise, it will fail with an exit code of 1.

在前面的示例中, flock查找/path/to/cron.lock 。 如果在一秒钟内获得了锁,它将运行脚本,否则将失败,退出代码为1。

在脚本中使用锁定机制 (Using a Locking Mechanism in the Scripts)

If the cron job executes a script, we can implement a locking mechanism in the script. Consider the following PHP script:

如果cron作业执行脚本,我们可以在脚本中实现锁定机制。 考虑以下PHP脚本:

<?php
$lockfile = sys_get_temp_dir() . '/' md5(__FILE__) . '.lock';
$pid      = file_exists($lockfile) ? trim(file_get_contents($lockfile)) : null;
if (is_null($pid) || posix_getsid($pid) === false) {
// Do something here
// And then create/update the lock file
file_put_contents($lockfile, getmypid());
} else {
exit('Another instance of the script is already running.');
}

In the preceding code, we keep pid of the current PHP process in a file, which is located in the system’s temp directory. Each PHP script has its own lock file, which is the MD5 hash of the script’s filename.

在前面的代码中,我们将当前PHP进程的pid保留在一个文件中,该文件位于系统的temp目录中。 每个PHP脚本都有其自己的锁定文件,该文件是脚本文件名的MD5哈希。

First, we check if the lock file exists, and then we get its content, which is the process ID of the last running instance of the script. Then we pass the pid to posix_getsid PHP function, which returns the session ID of the process. If posix_getsid returns false it means the process is not running anymore and we can safely start a new instance.

首先,我们检查锁定文件是否存在,然后获取其内容,该内容是脚本最后运行的实例的进程ID。 然后,将pid传递给posix_getsid PHP函数,该函数返回进程的会话ID。 如果posix_getsid返回false则意味着该进程不再运行,我们可以安全地启动一个新实例。

Anacron (Anacron)

One of the problems with Cron is that it assumes the system is running continuously (24 hours a day). This causes problems for machines which are not running all day long (like personal computers). If the system goes off during the time a task is scheduled to run, Cron will not run that task retroactively.

Cron的问题之一是它假设系统连续运行(一天24小时)。 这会导致整天未运行的计算机(例如个人计算机)出现问题。 如果在计划运行任务的时间内系统关闭,Cron将不会追溯运行该任务。

Anacron is not a replacement for Cron, but it has been developed to solve this problem. It runs the commands once a day, week or month but not on a minute-by-minute or hourly basis as Cron does. It is, however, guaranteed that the task will run even if the system goes off for an unanticipated period of time.

Anacron不能替代Cron,但已开发出用于解决此问题的方法。 它每天,每周或每月运行一次命令,但不像Cron那样每分钟或每小时运行一次。 但是,即使系统在意外的时间内关闭,也可以确保任务将运行。

Only root or a user with administrative privileges can manage Anacron tasks. Anacron does not run in the background like a daemon, but only once, executing the tasks which are due.

只有root或具有管理特权的用户才能管理Anacron任务。 Anacron不会像后台程序那样在后台运行,而只能执行一次,以执行到期的任务。

Anacron uses a configuration file (just like crontab) named anacrontabs. This file is located in the /etc directory.

Anacron使用名为anacrontabs的配置文件(就像crontab一样)。 该文件位于/etc目录中。

The content of this file looks like this:

该文件的内容如下所示:

# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

In an anacrontab file, we can only set the frequencies with a period of n days, followed by the delay time in minutes. This delay time is just to make sure the tasks do not run at the same time.

anacrontab文件中,我们只能将频率设置为n天,然后以分钟为单位设置延迟时间。 此延迟时间只是为了确保任务不会同时运行。

The third column is a unique name, which is used to identify the task in the Anacron log files.

第三列是唯一名称,用于在Anacron日志文件中标识任务。

The fourth column is the actual command to be run.

第四列是要运行的实际命令。

Consider the following entry:

考虑以下条目:

1       5       cron.daily              nice run-parts /etc/cron.daily

The above tasks are run daily, 5 minutes after Anacron is run. It uses run-parts to execute all the scripts within /etc/cron.daily.

上述任务每天运行一次,运行Anacron后5分钟。 它使用run-parts来执行/etc/cron.daily所有脚本。

The second entry in the list above runs every 7 days (weekly), with a 25 minutes delay.

上面列表中的第二个条目每7天(每周)运行一次,延迟25分钟。

Cron和Anacron之间的碰撞 (Collision Between Cron and Anacron)

As you have probably noticed, Cron is also set to execute the scripts inside /etc/cron.* directories. This sort of possible collision with Anacron is handled differently in different flavors of Linux. In Ubuntu, Cron checks if Anacron is present in the system, and if it so, it won’t execute the scripts within /etc/cron.* directories.

您可能已经注意到,Cron还被设置为执行/etc/cron.*目录中的脚本。 在不同版本的Linux中,与Anacron可能发生的这种冲突的处理方式有所不同。 在Ubuntu中,Cron会检查系统中是否存在Anacron,如果存在,它将不会执行/etc/cron.*目录中的脚本。

In other flavors of Linux, Cron updates the Anacron times-stamps when it runs the tasks, so Anacron won’t execute them if they have been already run by Cron.

在其他Linux版本中,Cron在运行任务时会更新Anacron时间戳,因此如果Cron已经运行了Anacron,则Anacron不会执行它们。

快速故障排除 (Quick Troubleshooting)

命令的绝对路径 (Absolute Path to the commands)

It’s a good habit to use the absolute paths to all the executables we use in a crontab file.

使用绝对路径指向crontab文件中使用的所有可执行文件是一个好习惯。

* * * * * /usr/local/bin/php /absolute/path/to/the/command

确保Cron守护程序正在运行 (Make Sure Cron Daemon Is Running)

If our tasks are not running at all, first we need to make sure the Cron daemon is running:

如果我们的任务根本没有运行,那么首先我们需要确保Cron守护程序正在运行:

ps aux | grep crond

The output should similar to this:

输出应类似于以下内容:

root      7481  0.0  0.0 116860  1180 ?        Ss    2015   0:49 crond

检查/etc/cron.allow/etc/cron.deny文件 (Check /etc/cron.allow and /etc/cron.deny Files)

If the cron jobs are not running, then we need to check if /etc/cron.allow exists. If it does, we need to make sure our username is listed in this file. If /etc/cron.deny exists, we need to make sure our username is not listed in this file.

如果cron作业没有运行,那么我们需要检查/etc/cron.allow存在。 如果是这样,我们需要确保此文件中列出了我们的用户名。 如果存在/etc/cron.deny ,则需要确保我们的用户名未在此文件中列出。

If we edit a user’s crontab file whereas the user does not exist in the /etc/cron.allow file, including the user in the /etc/cron.allow won’t run the cron until we re-edit the crontab file.

如果我们而用户不会在存在编辑用户的crontab文件/etc/cron.allow文件,包括用户在/etc/cron.allow直到我们重新编辑crontab文件将不会运行cron的。

执行权限 (Execute Permission)

We need to make sure that the owner of the crontab has the execute permissions for all the commands and scripts in the crontab file. Otherwise, the cron will not work. Execute permissions can be added to any folder or file with chmod +x /some/file.php

我们需要确保crontab的所有者具有crontab文件中所有命令和脚本的执行权限。 否则,cron将无法工作。 可以使用chmod +x /some/file.php将执行权限添加到任何文件夹或文件中

换行符 (New Line Character)

Every entry in the crontab should end with a new line. This means there must be a blank line after the last crontab entry, or the last cron job will never run.

crontab中的每个条目都应以新行结尾。 这意味着最后一个crontab条目后面必须有一个空行,否则最后一个cron作业将永远不会运行。

结语 (Wrapping Up)

Cron is a daemon, running a list of events scheduled to take place in the future. These jobs are listed in special configuration files called crontab files. Users can have their own crontab file, if they are allowed to use Cron, based on /etc/cron.allow or /etc/cron.deny files. In addition to user-level cron jobs, Cron also loads the system-wide cron jobs which are slightly different in syntax.

Cron是一个守护程序,运行计划在将来发生的事件的列表。 这些作业在称为crontab文件的特殊配置文件中列出。 如果允许用户使用基于/etc/cron.allow/etc/cron.deny files Cron,则用户可以拥有自己的crontab /etc/cron.deny files 。 除了用户级cron作业之外,Cron还加载语法上稍有不同的系统级cron作业。

Our tasks are commonly PHP scripts or command-line utilities. In systems which are not running all the time, we can use Anacron to run the events which happen in the period of n days. When working with Cron, we should also be aware of the tasks overlapping each other, to prevent data loss. After a cron job is finished, the output will be sent to the owner of the crontab and or the email(s) specified in the MAILTO environment variable.

我们的任务通常是PHP脚本或命令行实用程序。 在并非一直运行的系统中,我们可以使用Anacron运行n天之内发生的事件。 在使用Cron时,我们还应该注意任务相互重叠,以防止数据丢失。 cron作业完成后,输出将发送给crontab的所有者或MAILTO环境变量中指定的电子邮件。

Did you learn anything new from this post? Have we missed anything? Or did you just like this post and want to tell us how awesomely comprehensive it was? Let us know in the comments below!

您从这篇文章中学到了什么吗? 我们错过了什么吗? 还是您只是喜欢这篇文章,并想告诉我们它的综合程度如何? 在下面的评论中让我们知道!

翻译自: https://www.sitepoint.com/a-comprehensive-crash-course-into-cronjobs/

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. 跨站点脚本(xss)_安全性:防止跨站点脚本(XSS)

    跨站点脚本(xss)Cross-site scripting is one of the most common and popular web attacks.跨站点脚本是最常见和流行的Web攻击之一。 It allows an attacker to inject client-side code into web applications screens that are then viewed by the victims.它允许攻击者将…...

    2024/4/20 16:12:02
  2. 使用Angular和MongoDB创建博客应用程序:显示帖子

    在本系列教程的最后一部分 &#xff0c;您了解了如何编写用于用户登录的REST API端点。 您使用Mongoose从Node与MongoDB进行了交互。 成功验证之后&#xff0c;您将看到如何使用Angular Router导航到HomeComponent 。 在本系列教程的这一部分中&#xff0c;您将创建一个组件&a…...

    2024/5/1 16:41:23
  3. 在Dockerized环境中应用Angular运行时配置

    随着向云优先的转变以及托管基础架构和业务流程&#xff08;例如EWS&#xff0c;Azure AKS或GCP群集&#xff09;的兴起&#xff0c;应用程序环境需要进行准备和调整以适应新出现的需求。 这不是什么新鲜事&#xff0c;也不是未知数&#xff0c;但是承认这一事实是第一步&#…...

    2024/5/1 9:19:17
  4. vue,react,angular都在用的commit规范,了解一下?

    截图来自vue的PR: 1.commit-message规范必要性 统一格式的提交记录&#xff0c;更清晰和易读 可以通过提交记录来了解本次提交的目的&#xff0c;更好的CR和重构 更容易了解变更&#xff0c;定位和发现问题 每个提交描述都是经过思考的&#xff0c;改善提交质量 直接生成Ch…...

    2024/5/1 15:39:56
  5. 使用Angular和MongoDB创建博客应用:添加帖子

    在Angular博客教程系列的上一部分中&#xff0c;您学习了如何创建ShowPostComponent来在主页上显示博客文章列表。 您使用创建的REST API端点获取了从MongoDB Shell中插入的记录。 在本教程中&#xff0c;您将创建一个名为AddPostComponent的新组件&#xff0c;以提供用于将新…...

    2024/5/1 7:11:50
  6. 【Linux搭建专题】Shell基本语法

    Shell——前言 创建目录 mkdir /app mkair /app/test cd /app/test创建文件 vim test01.sh输入并保存脚本 echo "${JAVA_HOME}"赋予执行权限 chmod 777 test01.sh执行 sh test01.shShell——&#xff08;核心&#xff09;变量 readonly myUrl unset variable_…...

    2024/5/1 20:42:46
  7. AngularJS 官方案例:angular-phonecat

    官方案例-angular-phonecat angularJS官方提供了一个官方案例给大家进行循序渐进的学习,但是如果之前没有接触过node.js以及git的同学这个案例拿着也无从下手…这里就介绍一下怎么打开这个案例吧 准备工作: 1.Git 2.nodejs 3.npm 4.bower 5.http-server 如果需要成功的…...

    2024/5/1 20:26:15
  8. 动态调用动态库的方法

    登录 | 注册 罗马非一日建成 能成功的人多少都有一份坚持~~ 目录视图摘要视图订阅 动态调用动态库方法 | from web 标签&#xff1a; dll编译器classwinapilibrarynull2011-11-10 21:01 684人阅读 评论(0) 收藏 举报分类&#xff1a;c/c&#xff08;26&#xff09; 目录(?)[] …...

    2024/5/2 21:59:28
  9. 使用shell脚本和node命令行工具来自动化部署打包前端项目

    本文主要介绍shell脚本的一些基本用法以及在前端项目中的应用。将围绕以下几点来展开&#xff1a;shell基本用法&#xff08;变量&#xff0c;循环&#xff0c;传参&#xff0c;运算符&#xff0c;流程控制等&#xff09;使用shell脚本自动将项目打包部署到git服务器使用nodeJs…...

    2024/5/1 10:31:07
  10. 南京那家双眼皮开得好

    ...

    2024/5/1 16:24:57
  11. 我很喜欢研究这些比较酷的效果

    jquery简洁的响应式导航下拉菜单代码https://www.mk2048.com/demo/demo_target_desc.php?idia0bjhjkjjquery简洁响应式导航菜单代码jQuery css3扑克洗牌和扑克牌翻转效果代码https://www.mk2048.com/demo/demo_target_desc.php?idia0j0ikaajQuery css3扑克洗牌&#xff0c;扑…...

    2024/5/1 9:07:40
  12. 润乾报表与 ActiveReport JS 功能对比

    简介 润乾报表是用于报表制作的大型企业级报表软件&#xff0c;核心特点在于开创性地提出了非线性报表数学模型&#xff0c;采用了革命性的多源关联分片、不规则分组、自由格间运算、行列对称等技术&#xff0c;使得复杂报表的设计简单化&#xff0c;以往难以实现的报表可以轻…...

    2024/5/1 7:39:29
  13. 南京割双眼皮医院-来找美来

    ...

    2024/5/1 12:06:51
  14. 南京割双眼皮医院 优选美来

    ...

    2024/5/1 21:06:16
  15. 在北京割割的双眼皮特别小

    ...

    2024/5/1 16:56:17
  16. React 首页加载慢的问题性能优化(实际操作)

    学习了一段时间React&#xff0c;想真实的实践一下。于是便把我的个人博客网站进行了重构。花了大概一周多时间&#xff0c;网站倒是重构的比较成功&#xff0c;但是一上线啊&#xff0c;那个访问速度啊&#xff0c;是真心慢&#xff0c;慢到自己都不能忍受&#xff0c;那么小一…...

    2024/5/1 16:26:31
  17. 杭州做割双眼皮大概费用

    ...

    2024/5/1 10:56:16
  18. 南京有多少家医院割双眼皮一个月埋了三次线

    ...

    2024/5/1 19:25:17
  19. 仿着锤子科技官网进行的一个angular4.0项目~~~

    关于项目 关于angular4的一个项目&#xff0c;仿着锤子科技的官网写的&#xff0c;项目功能还没完全实现 代码我放在了GitHub上 biubiubiu传送门&#xff0c;在myTests仓库里&#xff0c;欢迎指正和交流&#xff0c;这个截的动图有点一言难尽。。。卡顿&#xff0c;有没有好的…...

    2024/5/1 15:09:47
  20. 双眼皮割了后 后期为什么会变窄

    ...

    2024/5/1 20:30:16

最新文章

  1. FP16、BF16、INT8、INT4精度模型加载所需显存以及硬件适配的分析

    大家好,我是herosunly。985院校硕士毕业,现担任算法研究员一职,热衷于机器学习算法研究与应用。曾获得阿里云天池比赛第一名,CCF比赛第二名,科大讯飞比赛第三名。拥有多项发明专利。对机器学习和深度学习拥有自己独到的见解。曾经辅导过若干个非计算机专业的学生进入到算法…...

    2024/5/3 21:32:37
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. 【php快速上手(四)】

    目录 PHP快速上手&#xff08;四&#xff09;PHP 类型比较1.松散比较&#xff08;Loose Comparison&#xff09;2.严格比较&#xff08;Strict Comparison&#xff09;3.类型转换 PHP 常量PHP字符串函数1. 字符串长度和截取2. 字符串查找和替换3. 字符串转换和格式化4. 字符串分…...

    2024/5/1 9:38:40
  4. 第十三届蓝桥杯大赛软件赛省赛C/C++ 大学 B 组 题解

    VP比赛链接 : 数据加载中... - 蓝桥云课 1 . 九进制 转 十进制 直接模拟就好了 #include <iostream> using namespace std; int main() {// 请在此输入您的代码int x 22*92*81*9;cout << x << endl ;return 0; } 2 . 顺子日期 枚举出每个情况即可 : …...

    2024/4/30 1:59:34
  5. k8s_入门_kubelet安装

    安装 在大致了解了一些k8s的基本概念之后&#xff0c;我们实际部署一个k8s集群&#xff0c;做进一步的了解 1. 裸机安装 采用三台机器&#xff0c;一台机器为Master&#xff08;控制面板组件&#xff09;两台机器为Node&#xff08;工作节点&#xff09; 机器的准备有两种方式…...

    2024/5/2 2:36:57
  6. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/1 17:30:59
  7. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/2 16:16:39
  8. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/4/29 2:29:43
  9. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/2 9:28:15
  10. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/4/27 17:58:04
  11. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/4/27 14:22:49
  12. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/4/28 1:28:33
  13. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/4/30 9:43:09
  14. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/4/27 17:59:30
  15. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/2 15:04:34
  16. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/4/28 1:34:08
  17. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/4/26 19:03:37
  18. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/4/29 20:46:55
  19. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/4/30 22:21:04
  20. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/1 4:32:01
  21. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/4/27 23:24:42
  22. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/4/28 5:48:52
  23. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/4/30 9:42:22
  24. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/2 9:07:46
  25. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/4/30 9:42:49
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57