Adding systemd support to automatically start the service 55/1755/1 accepted/trunk/20120917.204541 submit/trunk/20120917.201852
authorRusty Lynch <rusty.lynch@intel.com>
Mon, 17 Sep 2012 20:16:35 +0000 (13:16 -0700)
committerRusty Lynch <rusty.lynch@intel.com>
Mon, 17 Sep 2012 20:17:49 +0000 (13:17 -0700)
packaging/remotecontrol.service [new file with mode: 0644]
packaging/remotecontrol.spec

diff --git a/packaging/remotecontrol.service b/packaging/remotecontrol.service
new file mode 100644 (file)
index 0000000..a539e40
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=RemoteControl Daemon
+After=syslog.target 
+
+[Service]
+ExecStart=/usr/bin/start-remoteserver
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=always
+StandardOutput=syslog
+
+[Install]
+WantedBy=multi-user.target
+
index f197a22..693773f 100644 (file)
@@ -6,6 +6,7 @@ License:    Apache-2.0
 Url:        https://github.com/otcshare/remotecontrol
 Summary:    Remote Control App
 Source:     remotecontrol-%{version}.tar.bz2
+Source1:    remotecontrol.service
 BuildRequires:  pkgconfig(python)
 BuildRequires:  python-setuptools
 Requires:  python
@@ -32,8 +33,14 @@ python setup.py build
 %install
 python setup.py install --prefix=%{_prefix} --root=%{buildroot}
 
+mkdir -p $RPM_BUILD_ROOT/%{_libdir}/systemd/system/graphical.target.wants
+install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_libdir}/systemd/system/
+ln -sf ../remotecontrol.service $RPM_BUILD_ROOT/%{_libdir}/systemd/system/graphical.target.wants/remotecontrol.service
+
 %files
 %defattr(-,root,root,-)
 %doc README
 %{python_sitelib}/*
 %{_bindir}/start-remoteserver
+%{_libdir}/systemd/system/remotecontrol.service
+%{_libdir}/systemd/system/graphical.target.wants/remotecontrol.service
\ No newline at end of file