systemd的自动启动服务:无效的参数

时间:2017-03-21 11:22:15

标签: linux ubuntu service mono systemctl

我正在尝试在启动时启动服务。我的服务应该启动.exe文件与单声道。 当我尝试用它运行时:

sudo systemctl start myservice.service 

一切顺利,我的应用程序正在运行。但是,当我运行服务状态时,我会变得“糟糕”; Systemd Unit files状态。

sudo systemctl status myservice.service 
● myservice.service
   Loaded: loaded (/etc/systemd/system/myservice.service; bad; vendor preset: enabled)
   Active: active (running) since Ut 2017-03-21 12:01:05 CET; 2s ago
 Main PID: 3892 (mono)
   CGroup: /system.slice/myservice
           └─3892 /usr/bin/mono /opt/myapp/myapp.exe

当我运行启用命令时,我得到:

sudo systemctl enable myservice.service 
Failed to execute operation: Invalid argument

我的单位文件/etc/systemd/system/myservice.service包含:

[Unit]
Description=myservice
After=network.target

[Service]
ExecStart=/usr/bin/mono /opt/myapp/myapp.exe
WorkingDirectory=/opt/myapp
Restart=on-failure

[Install]
WantedBy=multi-user.target

任何人都可以帮我这个吗?..谢谢..

我在Ubuntu上工作:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial

sudo mono --version
Mono JIT compiler version 4.8.0 (Stable 4.8.0.495/e4a3cf3 Wed Feb 22 18:25:42 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

0 个答案:

没有答案