Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux systemd的自动启动服务:参数无效_Linux_Ubuntu_Service_Mono_Systemctl - Fatal编程技术网

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

Linux systemd的自动启动服务:参数无效,linux,ubuntu,service,mono,systemctl,Linux,Ubuntu,Service,Mono,Systemctl,我正在尝试在启动时启动服务。我的服务应该用mono启动.exe文件。 当我尝试使用以下工具运行它时: sudo systemctl start myservice.service 一切正常,我的应用程序正在运行。然而,当我运行服务状态时,我得到Systemd单元文件的“bad;”状态 sudo systemctl status myservice.service ● myservice.service Loaded: loaded (/etc/systemd/system/myser

我正在尝试在启动时启动服务。我的服务应该用mono启动.exe文件。 当我尝试使用以下工具运行它时:

sudo systemctl start myservice.service 
一切正常,我的应用程序正在运行。然而,当我运行服务状态时,我得到
Systemd单元文件的“bad;”状态

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
当我运行enable命令时,我得到:

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