3

I would like this to run as a service on my Ubuntu server 18.x... https://github.com/xiaodoudou/PlexIPTV

I have downloaded the linux x64 file, made it executable in my home folder and tried to run it. I also setup the initial settings.json file in the same folder. It worked out fine, so to get it as a service I tried following this guide: How can I make an executable run as a service?

So I made the file in /etc/systemd/system/, looking like the following:

[Unit]
Description=Plex IPTV-Tuner
After=network-online.target

[Service]
Type=simple
User=plex
Group=plex
UMask=007

ExecStart=/usr/bin/PlexIPTV/PlexIPTV.linux-x64

Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

I also moved the executable well as the settings.json file to /usr/bin/PlexIPTV/

Now, when I try to run the folder I get the error that it's not allowed to open /settings.json. I've tried to chmod 777 -R /usr/bin/PlexIPTV/ as well as chown plex:plex -R /usr/bin/PlexIPTV but it do not help.

Exact error I get:

● plex-iptv-tuner.service - Plex IPTV-Tuner
   Loaded: loaded (/etc/systemd/system/plex-iptv-tuner.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sun 2019-03-10 13:09:02 CET; 1s ago
  Process: 16218 ExecStart=/usr/bin/PlexIPTV/PlexIPTV.linux-x64 (code=exited, status=0/SUCCESS)
 Main PID: 16218 (code=exited, status=0/SUCCESS)

Mar 10 13:09:02 media systemd[1]: Started Plex IPTV-Tuner.
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]: 2019-03-10T12:09:02.397Z plexiptv:config:verbose 2019/03/10 13:09:02.3960 🔭 init Getting settings...
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]: 2019-03-10T12:09:02.398Z plexiptv:config:verbose 2019/03/10 13:09:02.3970 🔭 readSettings Reading file...
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]: 2019-03-10T12:09:02.399Z plexiptv:config:verbose 2019/03/10 13:09:02.3990 🔭 __dirname.readSettings.fs.readFile Didn't found file, injecting template...
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]: 2019-03-10T12:09:02.410Z plexiptv:config:error 2019/03/10 13:09:02.4090 🔥 __dirname.init.Q.fcall.then.then.catch.error Error happen during setting pulling:
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]: [ { Error: EACCES: permission denied, open '/settings.json'
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]:     errno: -13,
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]:     code: 'EACCES',
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]:     syscall: 'open',
Mar 10 13:09:02 media PlexIPTV.linux-x64[16218]:     path: '/settings.json' } ]
  • 1
    Do you actually get a "permission denied" error, or do you get "file not found"? I'm asking because I see no reason for it to look for settings.json in the root (/) directory. – Kusalananda Mar 10 at 12:21
  • 1
    @Kusalananda added the full error. – Jesper.Lindberg Mar 10 at 12:24
  • "I've tried to chmod 777 -R /usr/bin/PlexIPTV/ ..." - NEVER do that; it gives every user and every process on your system write access to that directory, which can easily turn a smaller security problem into a much bigger one. – marcelm Mar 10 at 14:08
  • @marcelm yeah I know, I was just running mad when it kept saying that it did not have the permission. – Jesper.Lindberg Mar 11 at 8:46
9

I also setup the initial settings.json file in the same folder. It worked out fine, so to get it as a service...

In the systemd service, set WorkingDirectory.

  • 1
    Setting the PLEXIPTV_SETTINGS environment variable and using the --settings command-line option are alternatives. – JdeBP Mar 10 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.