ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
**自启脚本,防止计划任务中断。** ~~~ cd /www/wwwroot/duo ~~~ ~~~ chmod -R 777 cronjob ~~~ 在宝塔中如下图所示。 ![](https://img.kancloud.cn/18/77/1877713c3e5e1fa967e9549199540604_1126x496.png) ![](https://img.kancloud.cn/f3/62/f362744ac16e40e9a2a3ab0273b16236_847x448.png) ![](https://img.kancloud.cn/df/b6/dfb6b0e80a9bb4b351d4b18b2a4fa981_819x487.png) 以下命令分别在计划任务中,添加两个。每分钟执行。 setting cronjob per 1 sec running. name 1: phpcron ~~~ /www/wwwroot/duo/cronjob/crontab.sh ~~~ name 2: srscron ~~~ cd /srs/srs/trunk && ./objs/srs -c /srs/srs/trunk/conf/http.flv.live.conf & ~~~ name 3: auto remove vanc data ~~~ php /www/wwwroot/duo/cronjob/del.php ~~~ ![](https://img.kancloud.cn/8e/32/8e32278482ddb128e4ba359c7eced433_734x485.png) 直播服务自启 ~~~ vim /etc/rc.local ~~~ 最后添加以下代码 ~~~ cd /srs/srs/trunk && ./objs/srs -c /srs/srs/trunk/conf/http.flv.live.conf & ~~~ 最后确认是否正常运行 Check cronjob is running ~~~ ps aux|grep cronjob ps aux|grep srs ~~~ ![](https://img.kancloud.cn/2e/4c/2e4c749188a5bb9fabe676b7a660a81d_771x251.png) 最后,重启系统。(at last reboot systemt) 登录后SSH执行 (use ssh command) ~~~ ps aux|grep cronjob ps aux|grep srs ~~~ ![](https://img.kancloud.cn/f0/8e/f08e153272b0cea1b838645a748d7b7a_733x178.png) 如果看到以上图中所示说明成功了。 if you see like pic show, cronjob is working.