添加開機自啟腳本,注意都需要用絕對路徑
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