php 常驻后台

来源:互联网 发布:外汇数据下载 编辑:程序博客网 时间:2024/05/16 19:37

1、后台运行:

[root@iz2zeiyr83gi07o1puquodz commands]# nohup php statistics.php &

[1] 4087
[root@iz2zeiyr83gi07o1puquodz commands]# nohup: ignoring input and appending output to ‘nohup.out’

[root@iz2zeiyr83gi07o1puquodz commands]# ll
total 16
-rw-r--r-- 1 root root    3 Sep 15 23:29 1.bat
-rw------- 1 root root 6065 Sep 18 21:42 nohup.out

-rw-r--r-- 1 root root 1292 Sep 18 21:21 statistics.php

2、查看日志:

[root@iz2zeiyr83gi07o1puquodz commands]# cat nohup.out

3、关闭运行:

[root@iz2zeiyr83gi07o1puquodz commands]# ps
  PID TTY          TIME CMD
 3922 pts/1    00:00:00 bash
 4087 pts/1    00:00:00 php
 4097 pts/1    00:00:00 ps
[root@iz2zeiyr83gi07o1puquodz commands]# kill 4087

原创粉丝点击