- 編寫(xiě)腳本autostart.sh
#!/bin/sh
# 執(zhí)行后臺(tái)服務(wù)啟動(dòng)
nohup java -jar /opt/etc/***.jar --spring.config.location=/opt/conf/ &
可能會(huì)出現(xiàn)的問(wèn)題:
autostart.sh:行2: $'\r': 未找到命令
nohup: 把輸出追加到'nohup.out'
啟動(dòng)報(bào)錯(cuò)蹲坷,或者不識(shí)別'/r' '/n' 等熟呛,檢查編寫(xiě)腳本工具是否有問(wèn)題,notepad->edit->EOL Conversion->Unix(LF)烫罩。
#這是因?yàn)槲谋揪庉嬡浖膯?wèn)題赏迟,與linux編碼不一致,建議直接使用電腦自帶的記事本編輯保存文檔
sed -i 's/\r//' start.sh
2妥凳、autostart.sh腳本路徑寫(xiě)入/etc/rc.d/rc.local文件最后一行中
3竟贯、linux 自啟動(dòng)node腳本
PM2
https://cloud.tencent.com/developer/article/2111619?from=15425