我升级到 Ubuntu 16.04,现在服务出现问题。
[Unit]
Description=Conan - dong sliders to MAX
After=syslog.target network.target
[Service]
ExecStart=/home/conan/exiles/start_conan.sh
User=conan
Type=simple
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
日志:
systemd[1]: conan.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped Conan - dong sliders to MAX.
systemd[1]: Started Conan - dong sliders to MAX.
conan : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/xvfb-run --auto-servernum --server-args=-screen 0 640x480x24:32 wine /home/conan/exiles/ConanSandboxServer.exe -log
sudo[5115]: pam_unix(sudo:session): session opened for user root by (uid=0)
sudo[5115]:start_conan.sh[5113]: wine: /home/conan/.wine is not owned by you
systemd[1]: conan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: conan.service: Unit entered failed state.
systemd[1]: conan.service: Failed with result 'exit-code'.
我的第一个想法是这 start_conan.sh[5113]: wine: /home/conan/.wine is not owned by you
就是问题所在。但.wine
归用户“conan”所有。
启动脚本:
#!/bin/sh
export WINEARCH=win64
export WINEPREFIX=/home/conan/.wine64
sudo xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine /home/conan/exiles/ConanSandboxServer.exe -log
答案1
您正尝试以 root 身份打开它(因为 sudo),并且该文件归 conan 所有。尝试:
# chown root:root /home/conan/.wine
如果您想以 conan 身份打开它,请-u conan
在脚本中的 sudo 命令后面添加。