[Reboot]Automatically start forever (node) on system restart
페이지 정보
작성자 sbLAB 댓글 0건 조회 3,463회 작성일 22-03-11 13:53본문
[정상작동 안됨]
forever path => /usr/local/bin
1. Create a bash script file (change bob to desired user).
vi /home/bob/node_server_init.sh
2. Copy and paste this inside the file you've just created.
#!/bin/sh
export NODE_ENV=production
export PATH=/usr/local/bin:$PATH
forever start /node/server/path/server.js > /dev/null
Make sure to edit the paths above according to your config!
3. Make sure the bash script can be executed.
chmod 700 /home/bob/node_server_init.sh
4. Test the bash script.
sh /home/bob/node_server_init.sh
5. Replace "bob" with the runtime user for node.
crontab -u bob -e
6. Copy and paste (change bob to desired user).
@reboot /bin/sh /home/bob/node_server_init.sh
Save the crontab.
service cron restart
service cron status
7. You've made it to the end, your prize is a reboot
https://stackoverflow.com/questions/13385029/automatically-start-forever-node-on-system-restart
[etc]
@reboot = run at boot and reboot only
@yearly = run at midnight Jan 1 each year (equiv to 0 0 1 1 *)
@annually = run at midnight Jan 1 each year (equiv to 0 0 1 1 *)
@monthly = run at midnight on the first day of each month (equiv to 0 0 1 * *)
@weekly = run at midnight each Sunday (equiv to 0 0 * * 0)
@daily = run at midnight each day (equiv to 0 0 * * *)
@ midnight = run at midnight each day (equiv to 0 0 * * *)
@ hourly = run on the first second of every hour (equiv to 0 * * * *)
댓글목록
등록된 댓글이 없습니다.