小编Jua*_*rés的帖子

在 ubuntu 16.04 上创建守护进程

我用 PHP 开发了一个爬虫,它解析一个带有特定标头的 URL,并将所有内容的 URL 放入队列中。它工作正常。

我在 ubuntu 14.04 中开发了这段代码,并在 /etc/init 文件夹中放置了一个 .conf 文件,其中包含以下内容:

# Info
description "Warm the varnish to get the list of products"
author      "Juanjo Aguilella"

# Events
start on startup
stop on shutdown

# Automatically respawn
respawn
respawn limit 100 5

# Run the script
# Note, in this example, if your PHP script return
# the string "ERROR", the daemon will stop itself.
script
    [ $(exec /usr/bin/php -f /var/www/crawler.php) = 'ERROR' ] && ( stop; …
Run Code Online (Sandbox Code Playgroud)

ubuntu daemon ubuntu-16.04

15
推荐指数
3
解决办法
8万
查看次数

标签 统计

daemon ×1

ubuntu ×1

ubuntu-16.04 ×1