6
从Systemd运行Java进程
我正在尝试从systemd执行shell脚本。该脚本可以从命令行正常运行。 脚本(runServer.sh)运行Java进程,如下所示: #!/bin/bash java -jar -Dresources=/home/pruss/dev/ServerDeploy5-4.1/Server/resources/MyServer.jar "0" "Test" 在内部/usr/lib/systemd/system(或/lib/systemd/system/在其他操作系统上),我创建了一个服务文件(myService.service): [Unit] Description=My Servers service [Service] ExecStart=/home/pruss/dev/ServerDeploy5-4.1/Server/runServer.sh User=root Type=oneshot [Install] WantedBy=multi-user.target 结果 Job for myService.service failed. See "systemctl status myService.service" and "journalctl -xn" for details. 我尝试: systemctl status myService.service Loaded: loaded (/usr/lib/systemd/system/myService.service; disabled) Active: failed (Result: exit-code) since Thu 2015-07-23 12:27:38 BST; …