Autostart service for systemd: Invalid Argument

I am trying to start a service at startup. My service needs to run the .exe file with mono. When I try to start it with:

sudo systemctl start myservice.service 

      

Everything is going well and my application is working. However, when I run the status for the service, I get "bad"; for status 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

      

When I run the enable command, I get:

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

      

My unit / etc / systemd / system / myservice.service file contains:

[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

      

Can anyone help me with this? .. thanks ..

I am working on Ubuntu:

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

      

Mono:

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

      

+3


source to share





All Articles