Centos7下shell腳本添加開機自啟動


添加開機自啟腳本,注意都需要用絕對路徑

psubscribe.sh腳本中的內容:

nohup /usr/bin/php -f /data/aliyun51015cn/redisChannel/psubscribe.php > psubscribe.log &

 

1、賦予腳本可執行權限(/opt/script/psubscribe.sh是你的腳本路徑)

# chmod 777 /data/aliyun51015cn/redisChannel/psubscribe.sh

2、打開/etc/rc.d/rc.local文件,在末尾增加如下內容

# echo "/data/aliyun51015cn/redisChannel/psubscribe.sh" >> /etc/rc.d/rc.local

3、在centos7中,/etc/rc.d/rc.local的權限被降低了,所以需要執行如下命令賦予其可執行權限

# chmod +x /etc/rc.d/rc.local


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM