Run the console command script based on Supervisor, after running 1 time, run the implementation of the console command script again after 60 seconds
1. Configuration file \channel-pub-api\build\c_files\etc\supervisord.d\yii-qq-transaction-video-sync.ini
[program:yii-qq-transaction-video-sync]
command = php /sobey/www/channel-pub-api/yii qq-transaction-video/sync
autorestart = true
startsecs = 0
stopwaitsecs = 10
stderr_logfile = /data/logs/yii-qq-transaction-video-sync-stderr.log
stdout_logfile = /data/logs/yii-qq-transaction-video-sync-stdout.log
2. In the console command script, run once, write 1 file, the code is as follows
file_put_contents('/sobey/www/channel-pub-api/console/runtime/' . date('Y-m-d-H-i-s') . '.txt', time());
3. After the development environment is upgraded, check the directory /sobey/www/channel-pub-api/console/runtime/ .
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-29.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-30.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-31.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-32.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-33.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-34.txt
-rw-r--r-- 1 root root 10 Nov 15 10:28 2018-11-15-10-28-35.txt
4. The current requirement is that after running once, run the console command script again after 60 seconds, and finally decide to implement the Sleep based on the script. bout
// 延缓执行 60 秒
sleep(60);
-rw-r--r-- 1 root root 10 Nov 15 10:45 2018-11-15-10-45-35.txt
-rw-r--r-- 1 root root 10 Nov 15 10:46 2018-11-15-10-46-36.txt
-rw-r--r-- 1 root root 10 Nov 15 10:47 2018-11-15-10-47-37.txt
-rw-r--r-- 1 root root 10 Nov 15 10:48 2018-11-15-10-48-38.txt
-rw-r--r-- 1 root root 10 Nov 15 10:49 2018-11-15-10-49-39.txt