4

我正在尝试在启动时启动服务。我的服务应该以单声道启动 .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
4

0 回答 0