이는 다른 주제에 대한 질문과 다릅니다. 내 우분투에서 서비스를 만들려고 하는데 이 서비스가 비활성(죽음)이라고 계속 표시됩니다.
내 운영체제:
내 서비스(/etc/systemd/system/resume.service에서):
[Unit]
Description=Run commands after resume from suspend
After=suspend.target
[Service]
ExecStart=/bin/sh /usr/local/bin/resume.sh
[Install]
WantedBy=suspend.target
내 쉘 스크립트(/usr/local/bin/resume.sh에서):
#!/bin/sh
# Workaround for XFCE bug re black screen on resume from suspend:
# if a user is logged into an X session via xfce, run 'xrandr --auto' to restore default display.
for id in $(loginctl list-sessions --no-legend | awk '{ print $1 }')
do
s="$(loginctl show-session "$id")"
if printf "$s" | grep -q 'Display=:0'
then
if printf "$s" | grep -q 'Desktop=xfce'
then
u="$(printf "$s" | grep 'Name=' | cut -d'=' -f2)"
DISPLAY=:0 su "$u" -c 'xrandr --auto'
exit
fi
fi
done
나는 노력했다이 명령하지만 서비스를 활성화할 수 없습니다.
sudo systemctl enable resume.service
sudo systemctl start resume.service
$sudo systemctl statusresume.service를 실행한 후:
○ resume.service - Run commands after resume from suspend
Loaded: loaded (/etc/systemd/system/resume.service; enabled; vendor pres>
Active: inactive (dead)
سپتامبر 15 22:59:00 linux systemd[1]: resume.service: Deactivated successfull>
سپتامبر 15 22:59:30 linux systemd[1]: Started Run commands after resume from >
سپتامبر 15 22:59:30 linux systemd[1]: resume.service: Deactivated successfull>
سپتامبر 15 23:00:57 linux systemd[1]: Started Run commands after resume from >
سپتامبر 15 23:00:57 linux systemd[1]: resume.service: Deactivated successfull>
سپتامبر 15 23:04:02 linux systemd[1]: Started Run commands after resume from >
سپتامبر 15 23:04:02 linux systemd[1]: resume.service: Deactivated successfull>
سپتامبر 15 23:10:36 linux systemd[1]: Starting Run commands after resume from>
سپتامبر 15 23:10:36 linux systemd[1]: resume.service: Deactivated successfull>
سپتامبر 15 23:10:36 linux systemd[1]: Started Run commands after resume from