Mylar as a service

Post any problems / bugs / issues that are Mylar-related in here.
Post Reply
musictrivianut
Posts: 19
Joined: Fri Jun 10, 2016 10:07 am

Mylar as a service

Post by musictrivianut »

Well, I got an answer to my first question and can run Mylar3 now. However, I am running into issues when setting it up to run as a service.

Followed the directions and it faults out and complains about line 61 in Mylar.py.

Code: Select all

mylar.service - LSB: starts instance of mylar
     Loaded: loaded (/etc/init.d/mylar; generated)
     Active: failed (Result: exit-code) since Mon 2021-04-19 21:43:24 EDT; 3s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 731692 ExecStart=/etc/init.d/mylar start (code=exited, status=1/FAILURE)

Apr 19 21:43:24 wayne-desktop systemd[1]: Starting LSB: starts instance of mylar...
Apr 19 21:43:24 wayne-desktop mylar[731692]:  * Starting mylar
Apr 19 21:43:24 wayne-desktop mylar[731716]:   File "Mylar.py", line 61
Apr 19 21:43:24 wayne-desktop mylar[731716]:     cmdlinepath = f'/proc/{checkpid}/cmdline'
Apr 19 21:43:24 wayne-desktop mylar[731716]:                                             ^
Apr 19 21:43:24 wayne-desktop mylar[731716]: SyntaxError: invalid syntax
Apr 19 21:43:24 wayne-desktop systemd[1]: mylar.service: Control process exited, code=exited, status=1/FAILURE
Apr 19 21:43:24 wayne-desktop mylar[731692]:    ...fail!
Apr 19 21:43:24 wayne-desktop systemd[1]: mylar.service: Failed with result 'exit-code'.
Apr 19 21:43:24 wayne-desktop systemd[1]: Failed to start LSB: starts instance of mylar.
As last time, any and all help appreciated!
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Mylar as a service

Post by evilhero »

That looks like you're using the old init scripts from the python2 repo.

Most recent versions of Ubuntu ( > 16), use systemd now and you can completely do away with the init.d stuff.

If you look in the root of the mylar repo / init-scripts / systemd / you'll find a mylar.service file and a read.me file.

Here's the blurb from the read.me:

Code: Select all

Instructions on setting up mylar3 as a systemd service that will run on startup/via systemctl commands...

1 - copy the mylar.service to /lib/systemd/system/mylar.service
2 - edit the /lib/systemd/system/mylar.service file (change user, group, python path, and mylar location to user-specific requirements)
3 - create a symbolic link to it:  ln -s /lib/systemd/system/mylar.service /etc/systemd/system/mylar.service
4 - make systemd aware of new services:  sudo systemctl daemon-reload
5 - set mylar3 to auto-start on startup: sudo systemctl enable mylar
6 - start mylar3 up:                     sudo systemctl start mylar
7 - to check to see if running/status:   sudo systemctl status mylar
You don't need the init.d scripts for mylar3- so just disable them from running and remove them if you're familiar enough to do that (disabling the service would be enough otherwise). The init scripts were a very hacky way of getting system starts working, that was never really clean and more convoluted than anything.

Best idea is to avoid using them if you can at all.
musictrivianut
Posts: 19
Joined: Fri Jun 10, 2016 10:07 am

Re: Mylar as a service

Post by musictrivianut »

Got it. Thanks for that! I've only been using linux/Ubuntu for about 4 years and don't always know when to use what <sigh>. Appreciate it!
musictrivianut
Posts: 19
Joined: Fri Jun 10, 2016 10:07 am

Re: Mylar as a service

Post by musictrivianut »

Win!

Note to self and all: Typos in path cause failures <sigh>

Oh! And thank you very much for this outstanding piece of software!!!
Post Reply