[Newark] Running a simple script as a service

Richard M Eggleston Richard at richardeggleston.co.uk
Mon Mar 1 12:24:58 UTC 2021


Hi All,

I realise this is fairly low level stuff, and I have spent a fair bit of time on search engines and forums, but my specific question isn’t being addressed


I have been running sickgear as a PVR (I know about torrents and copyright breach..don’t @me, I’m a big boy) however it starts by running the following from a command line

Cd /opt/sickgear
Sudo -u python3 ./sickgear.py

And that works nicely

So being a good soldier,(i.e Lazy) I combined these into a bash script (called runsickgear.sh)

#!/bin/bash
Cd /opt/sickgear
Sudo -u python3 ./sickgear.py

Which can be run from CL and works beautifully..

bash runsickgear.sh

Now me, being me, I don’t want the hassle of running no lousy scripts, and I don’t want any untidy terminals left open either (OCD? No not me)
I would like this to run as a service at boot time, and Be stopped, started and messed around with using

Sudo systemctl sickgear {stop/start/enable/halt & catchfire}

SO I copy the runsickgear.sh script to

/usr/bin/sickgear/runsickgear.sh

Generate a file /etc/systemd/system/sickgear.service
 Which looks like


[Unit]
Description=sickgear service

[Service]
 ExecStart=/usr/bin/sickgear/runsickgear.sh

[Install]
WantedBy=Multi-User.Target

Now according to Google, etc after I run 
Sudo systemctl daemon-reload
Then I should be able to do systemctl enable etc

But I can’t, 

And the logs seem to give me no insight, and the Ubuntu forums seem more interested in angels dancing on heads of pins or whether 
I am fairly sure this is a syntax error somewhere, but what ever I do, it doesn’t seem to work.. Given my desk and keyboard now have forehead shaped dents in need help. Google has loads o examples, and I have worked through many of them (Mostly look the same as the ones I’ve shown)

Any bright ideas?

Cheers
Richard

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/newark/attachments/20210301/c8ba1562/attachment.html>


More information about the Newark mailing list