Add systemd script
Andy Bavier [Mon, 28 Oct 2013 19:17:35 +0000 (15:17 -0400)]
planetstack/redhat/planetstack-backend.service [new file with mode: 0755]
setup.py

diff --git a/planetstack/redhat/planetstack-backend.service b/planetstack/redhat/planetstack-backend.service
new file mode 100755 (executable)
index 0000000..90d3c7c
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=PlanetStack Observer
+After=syslog.target network.target
+
+[Service]
+Type=forking
+User=root
+PIDFile=/var/run/planetstack-backend.pid
+ExecStart=/usr/sbin/daemonize -c /opt/planetstack -p /var/run/planetstack-backend.pid /opt/planetstack/planetstack-backend.py
+ExecStop=kill $(cat /var/run/planetstack-backend.pid)
+
+[Install]
+WantedBy=multi-user.target
+
index 79a90ef..a250b29 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -20,6 +20,7 @@ setup(name='planetstack',
       scripts=['planetstack/planetstack-backend.py'],
       data_files=[
         ('/etc/planetstack/', ['planetstack/plstackapi_config']),
+        ('/lib/systemd/system/', ['planetstack/redhat/planetstack-backend.service']),
         ])
 
 copytree('planetstack/', '/opt/planetstack')