Hi!
Trying to autostart a pyhon script, and have tried all sorts of things, but cannot get it to work.
https://github.com/iBaa/PlexConnect
Current status:
Have put PlexConnect in this path: /home/PlexConnect-master
I then created a systemd service file like this (located in /etc/systemd/system/PlexConnect.service):
$this->bbcode_second_pass_code('', '[Unit]
Description=PlexConnect service
# Make sure we have functional network and logging available
After=syslog.target
After=network.target
After=default.target
[Service]
# Allow process forking or oneshot
ExecStart=/home/PlexConnect-master/PlexConnect.sh start
Type=forking
RemainAfterExit=yes
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=10
[Install]
WantedBy=multi-user.target')
To make it start on boot, I used:
$this->bbcode_second_pass_code('', 'systemctl enable PlexConnect')
The PlexConnect.sh file is set to 755, and contains:
$this->bbcode_second_pass_code('', '#!/bin/bash
/home/PlexConnect-master/PlexConnect.py')
If I run it from the terminal, it works just fine:
$this->bbcode_second_pass_code('', '[root@alarm PlexConnect-master]# /home/PlexConnect-master/PlexConnect.sh
19:22:09 PlexConnect: ***
19:22:09 PlexConnect: PlexConnect
19:22:09 PlexConnect: Press CTRL-C to shut down.
19:22:09 PlexConnect: ***
19:22:09 PlexConnect: started: 19:22:09
19:22:09 PlexConnect: Version: 0.3.1+
19:22:09 PlexConnect: Python: 2.7.6 (default, Nov 29 2013, 11:17:54)
[GCC 4.7.2]
19:22:09 PlexConnect: Host OS: linux2
19:22:09 PlexConnect: IP_self: 192.168.1.96
19:22:09 DNSServer: started: 19:22:09
19:22:09 DNSServer: ***
19:22:09 DNSServer: DNSServer: Serving DNS on 192.168.1.96 port 53.
19:22:09 DNSServer: intercept: ['trailers.apple.com'] => 192.168.1.96
19:22:09 DNSServer: restrain: ['mesu.apple.com', 'appldnld.apple.com', 'appldnld.apple.com.edgesuite.net'] => 127.0.0.1
19:22:09 DNSServer: forward other to higher level DNS: 8.8.8.8
19:22:09 DNSServer: ***
19:22:09 WebServer: started: 19:22:09
19:22:09 WebServer: ***
19:22:09 WebServer: WebServer: Serving HTTP on 192.168.1.96 port 80.
19:22:09 WebServer: ***
19:22:09 WebServer: started: 19:22:09
19:22:09 WebServer: ***
19:22:09 WebServer: WebServer: Serving HTTPS on 192.168.1.96 port 443.
')
But if I try to run it using sysctl it fails:
$this->bbcode_second_pass_code('', '[root@alarm PlexConnect-master]# systemctl status PlexConnect.service
PlexConnect.service - PlexConnect service
Loaded: loaded (/etc/systemd/system/PlexConnect.service; enabled)
Active: failed (Result: timeout) since Tue 2014-01-28 19:44:30 CST; 22s ago
Process: 295 ExecStart=/home/PlexConnect-master/PlexConnect.sh (code=killed, signal=TERM)
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: ***
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: started: 19:44:22
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: Version: 0.3.1+
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: Python: 2.7.6 (default, Nov 29 2013, 11:17:54)
Jan 28 19:44:22 alarm PlexConnect.sh[295]: [GCC 4.7.2]
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: Host OS: linux2
Jan 28 19:44:22 alarm PlexConnect.sh[295]: 19:44:22 PlexConnect: IP_self: 192.168.1.96
Jan 28 19:44:30 alarm systemd[1]: PlexConnect.service operation timed out. Terminating.
Jan 28 19:44:30 alarm systemd[1]: Failed to start PlexConnect service.
Jan 28 19:44:30 alarm systemd[1]: Unit PlexConnect.service entered failed state.
[root@alarm PlexConnect-master]#')
What am I doing wrong?