All Articles

웹서버를 systemd로 동작시키기

  1. systemd 등록

    $ cat /etc/systemd/system/youngminz.com.service
    [Unit]
    Description=youngminz.com Service
    
    [Service]
    User=ubuntu
    EnvironmentFile=/home/ubuntu/workspaces/app-gateway/.env <-- 환경 변수 파일 추가할거면 이거 추가하기
    ExecStart=/home/ubuntu/.sdkman/candidates/java/17.0.2-tem/bin/java -jar /home/ubuntu/youngminz.com/quarkus-run.jar
    SuccessExitStatus=143
    
    TimeoutStopSec=10
    Restart=on-failure
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
  2. 데몬 재시작

    sudo systemctl daemon-reload
  3. 웹 서버 켜기

    sudo systemctl start youngminz.com.service
  4. 웹 서버 끄기

    sudo systemctl stop youngminz.com.service