在/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