4

I am trying to start service at startup. My service should start .exe file with mono. When I try to just run it with:

sudo systemctl start myservice.service 

Everything goes okay and my app is running. However when i run status for service i get "bad;" for Systemd Unit files status.

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 enable command i get:

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

My unit file /etc/systemd/system/myservice.service 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?.. thank you..

I 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
Pavol
  • 552
  • 8
  • 19
  • Possible duplicate of [Problems trying to enable/start custom target in systemd](https://stackoverflow.com/questions/20425069/problems-trying-to-enable-start-custom-target-in-systemd) – jhfrontz Aug 12 '19 at 21:34

0 Answers0