在/mnt目录下写了两个php的脚本文件,里面包含swoole的一些服务器的启动,现在要实现开机启动这两给php脚本文件,操作如下:
1,cd /etc/rc.d/init.d;
2,新增开机启动shell脚本myscript.sh,内容如下:
#!/bin/bash
# chkconfig: 2345 90 99
# description: express_task service auto start
/usr/bin/php /mnt/ClientOne.php
/usr/bin/php /mnt/Server.php
3,赋予myscript.sh可执行权限:chmod +x ./myscript.sh;
4,添加脚本到开机启动项目中:
①:chkconfig --add myscript.sh
②:chkconfig myscript.sh on
5,重启,验证结果:reboot