일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- 리눅스
- java
- JS
- PostgreSQL
- Linux
- javascript
- install
- 파이썬
- 자바스크립트
- 하모니카
- 데이터베이스
- 스크립트
- 자바
- ubuntu
- DB
- 3.0
- 윈도우
- 설정
- DATABASE
- Windows
- hamonikr
- 아틀라시안
- python
- Atlassian
- 노드
- postgres
- 설치
- 우분투
- script
- node
- Today
- Total
LukeHan 의 잡다한 기술 블로그
systemd 본문
systemd 간략 정리
service 옵션정리
GUI 가 준비된 후 실행 방법
[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/pi/.Xauthority"
[Install]
WantedBy=graphical.target
관련 설명
An application needs two things to open a window on an X display. It needs to know the location of the X display; that's conveyed by the DISPLAY environment variable. It also needs to authenticate with the X server. This is conveyed through a cookie, which is a secret value generated by the X server when it starts and stored in a file that only the user who started the X server can access. The default cookie file is ~/.Xauthority.
If your X server is using the default cookie file location, then adding Environment=XAUTHORITY=/home/dogs/.Xauthority will work (assuming /home/dogs is the home directory of the user who is logged in under X). If you need to find the location, see Can I launch a graphical program on another user's desktop as root? and Open a window on a remote X display (why “Cannot open display”)?
Alternatively, running the program as the user who is running the X server will work, provided that the cookie file is in the default location (if not, you'll have to locate the cookie file, like in the root case). Add the User directive (e.g. User=dogs).
Of course the service won't run if there isn't an X display by that number owned by the user you specify.
It's rather bizarre to start a GUI program from Systemd. It wasn't designed for this. GUI programs live in an X session, started by a user. Systemd is for system processes. You should experiment with daemons instead.
출처 : unix.stackexchange.com/questions/85244/setting-display-in-systemd-service-file