如何从 systemd 服务运行 Firefox?

如何从 systemd 服务运行 Firefox?

不知道如何修复/system.slice/unsplashpi.service is not a snap cgroup错误。

$ cat /etc/systemd/system/unsplashpi.service
[Unit]
Description=unsplashpi
After=multi-user.target

[Service]
Type=forking
ExecStart=/home/ubuntu/run.sh
User=ubuntu
WorkingDirectory=/home/ubuntu

[Install]
WantedBy=multi-user.target
EOF
$ cat /home/ubuntu/run.sh
#! /bin/bash

startx /home/ubuntu/unsplashpi.sh &> /home/ubuntu/startx.log &
$ cat /home/ubuntu/unsplashpi.sh
#! /bin/bash

DISPLAY=:0 firefox --kiosk --private-window --width 1080 --height 1920 "https://askubuntu.com" &

while :
do
  sleep 60
done
$ cat /home/ubuntu/startx.log
/system.slice/unsplashpi.service is not a snap cgroup

相关内容