본문 바로가기

IT

Unbuntu Server(Raspberry PI)에 서비스 등록하기

반응형

내가 만든 프로그램을 서비스로 등록을 해야하는 경우(?)가 있다

내가 라즈베리를 산 이유...

 

만든 프로그램으로 서비스를 돌리기위해 먼저 당연히 프로그램을 서버에 적당한(?) 폴더에 복사하고

프로그램을 실행할 스크립트를 만든다 

 

그리고 /etc/systemd/system/myservice.service

형태로 파일을 만든 다음 파일 내용을

작성하면 되는데 

관련 내용은 

https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files

 

Understanding Systemd Units and Unit Files | DigitalOcean

Increasingly, Linux distributions are adopting or planning to adopt the systemd init system. This powerful suite of software can manage many aspects of your server, from services to mounted devices and system states. In systemd, a unit refers to any r

www.digitalocean.com

을 확인하면 되는데 너무 복잡하다 

그냥 프로그램 실행만 하면 되는데...

 

그냥 필수 파일만 작성한다

[Unit]
Description=serviceName

[Service]
ExecStart=/path/path/servce.sh

[Install]
WantedBy=multi-user.target

그리고

systemctl enable serviceName
service serviceName start

실행을 하면 서비스로 등록이 된다 

반응형

'IT' 카테고리의 다른 글

Gmail 메일 정리  (0) 2020.03.06
MediaWiki 설정  (0) 2020.03.05
Raspberry PI Ubuntu에서 gnome-desktop 설치  (0) 2020.02.29
Raspberry pi 4B에 ubuntu 64bit 설치  (0) 2020.02.28
Asus BlueCave 공유기 Merlin Firmware  (0) 2020.02.11