danielewood / plexargod

Plex Argo Daemon - A systemd script to update the Plex API to use the current cloudflared tunnel address for remote access
Creative Commons Zero v1.0 Universal
128 stars 12 forks source link

adding Service lines #6

Open gazigo opened 3 years ago

gazigo commented 3 years ago

Hi @danielewood Thanks for creating this. I have followed your setup and i have only one problem with adding

ExecStartPre=/usr/local/bin/cloudflared update ExecStartPost=/usr/local/bin/plexargod Environment=RUN_BY_SYSTEMD=1

can you please explain where do i need to add those lines ? I tried with this commend in putty ( cloudflared.service ) ad i have tried also ( Service ) but I'm not getting anything.

danielewood commented 3 years ago

On a Debian/Ubuntu system, you are editing /etc/systemd/system/cloudflared.service

Example file contents with the changes made:

[Unit]
Description=Argo Tunnel
After=network.target

[Service]
TimeoutStartSec=0
Type=notify
ExecStartPre=/usr/local/bin/cloudflared update
ExecStart=/usr/local/bin/cloudflared --config /etc/cloudflared/config.yml --origincert /etc/cloudflared/cert.pem --no-autoupdate
ExecStartPost=/usr/local/bin/plexargod
Environment=RUN_BY_SYSTEMD=1
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

After you have made the changes:

sudo systemctl daemon-reload
sudo systemctl restart cloudflared