서비스 파일 작성
[Unit]
Description=My App
After=network.target
[Service]
Type=simple
User=www
WorkingDirectory=/opt/myapp
ExecStart=/usr/bin/node server.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target서비스 관리 명령어
systemctl start myapp
systemctl enable myapp # 부팅 시 자동 시작
systemctl status myapp
journalctl -u myapp -f # 실시간 로그
댓글 0