我有一个 java 文件,我正在尝试将其安装为服务。但我收到错误。以下是我的文件和错误的内容。我正在运行 Debian 8。
[Unit]
Description=App1Manager
After=syslog.target
[Service]
ExecStart=/usr/bin/jsvc -user root -cp /usr/share/java/commons-daemon.jar:/usr/local/myapp/bin/Manager.jar -pidfile /var/run/app1manager.pid
Type=forking
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
使用以下任一方法,我都会收到以下错误:
SYSTEMD_LOG_LEVEL=debug /lib/systemd/system/myapp1
SYSTEMD_LOG_LEVEL=debug /etc/init.d/myapp1
/etc/init.d/myapp1: line 1: [Unit]: command not found
/etc/init.d/myapp1: line 6: [Service]: command not found
/etc/init.d/myapp1: line 7: -user: command not found
/etc/init.d/myapp1: line 10: [Install]: command not found
Aug 12 12:04:39 debian systemd[3903]: Failed at step EXEC spawning /etc/init.d/myapp1: Exec format error
-- Subject: Process /etc/init.d/myapp1 could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel …
Run Code Online (Sandbox Code Playgroud)