研究出来了通过 /etc/rc.local -> /root/autostart.sh 自启动的方法
This commit is contained in:
parent
68b8fced7c
commit
c0d8243ba7
@ -2,12 +2,12 @@ echo 'Starting gogs git service in screen...'
|
|||||||
#screen -dmS gogs
|
#screen -dmS gogs
|
||||||
#screen -S gogs -X stuff "/root/gogs/gogs web\n"
|
#screen -S gogs -X stuff "/root/gogs/gogs web\n"
|
||||||
cd ~/git/
|
cd ~/git/
|
||||||
pm2 start -x './gogs/gogs' -n git.gogs -- web
|
sudo pm2 start -x './gogs/gogs' -n git.gogs -- web # sudo it so that pm2 list shows it as root
|
||||||
cd ~
|
cd ~
|
||||||
|
|
||||||
echo 'Starting http2https web service in pm2...'
|
echo 'Starting http2https web service in pm2...'
|
||||||
cd ~/git/www
|
cd ~/git/www
|
||||||
pm2 start server.js --name git.http2https
|
sudo pm2 start server.js --name git.http2https # sudo it so that pm2 list shows it as root
|
||||||
cd ~/
|
cd ~/
|
||||||
|
|
||||||
echo 'Done!'
|
echo 'Done!'
|
||||||
|
@ -35,11 +35,11 @@ sed -i "s/^PermitRootLogin yes/#PermitRootLogin yes/g" /etc/ssh/sshd_config
|
|||||||
service sshd restart
|
service sshd restart
|
||||||
|
|
||||||
echo ">>> set autostart"
|
echo ">>> set autostart"
|
||||||
|
mv /etc/rc.local /etc/rc.local.backup
|
||||||
touch /etc/rc.local
|
touch /etc/rc.local
|
||||||
chmod +x /etc/rc.local
|
chmod +x /etc/rc.local
|
||||||
echo "#!/bin/bash"
|
echo '#!/bin/bash' > /etc/local # can't omit, otherwise you can't launch pm2 in autostart.sh. Don't use double quote here, otherwise error.
|
||||||
echo "exec /root/autostart.sh"
|
echo 'source /root/autostart.sh' >> /etc/rc.local # make sure to sudo pm2 in autostart.sh, otherwise pm2 list can't find it as root.
|
||||||
echo "exit 0"
|
|
||||||
touch /root/autostart.sh
|
touch /root/autostart.sh
|
||||||
chmod +x /root/autostart.sh
|
chmod +x /root/autostart.sh
|
||||||
|
|
||||||
|
@ -10,4 +10,5 @@ ln -s ~/linux.config/.emacs.lisp ~/
|
|||||||
ln -s ~/linux.config/.bashrc ~/
|
ln -s ~/linux.config/.bashrc ~/
|
||||||
ln -s ~/linux.config/.bash_profile ~/
|
ln -s ~/linux.config/.bash_profile ~/
|
||||||
. ~/.bashrc
|
. ~/.bashrc
|
||||||
|
git config --global confidential.helper cache
|
||||||
echo "######## 完毕 ##################"
|
echo "######## 完毕 ##################"
|
||||||
|
Loading…
Reference in New Issue
Block a user