Merge pull request #2 from clrkwllms/master

Adds systemd service file.
diff --git a/Makefile b/Makefile
index 23fbcde..cf4879a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@
 	$(INSTALL) starvation_monitor -m 755 $(DESTDIR)/usr/bin/
 	$(INSTALL) README.md -m 644 $(DESTDIR)/usr/share/$(NAME)-$(VERSION)
 
-.PHONY: clean tarball
+.PHONY: clean tarball redhat
 clean:
 	@test ! -f starvation_monitor || rm starvation_monitor
 	@test ! -f src/starvation_monitor.o || rm src/starvation_monitor.o
diff --git a/redhat/Makefile b/redhat/Makefile
index 25d7bc9..81ded12 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -7,6 +7,7 @@
 		--define "_builddir 	$(HERE)/BUILD" \
 		--define "_rpmdir	$(HERE)/RPMS" \
 		--define "_srcrpmdir	$(HERE)/SRPMS"
+INSTALL	:= install
 
 all: rpm
 
@@ -23,3 +24,8 @@
 
 clean:
 	@rm -rf $(RPMDIRS) *~
+
+install:
+	$(INSTALL) -m 755 -d $(DESTDIR)/etc/systemd/system
+	$(INSTALL) starvation_monitor.conf -m 644 $(DESTDIR)/etc/systemd
+	$(INSTALL) starvation_monitor.service -m 644 $(DESTDIR)/etc/systemd/system
diff --git a/redhat/starvation_monitor.conf b/redhat/starvation_monitor.conf
new file mode 100644
index 0000000..9e256bf
--- /dev/null
+++ b/redhat/starvation_monitor.conf
@@ -0,0 +1,44 @@
+#
+# parameters for the starvation_monitor service
+#
+
+# list of cpus to monitor (default: all online)
+# ex: CLIST="-c 1,2,5"
+CLIST=
+
+# Aggressive mode
+# ex: AGGR=-A
+AGGR=
+
+# Period parameter for SCHED_DEADLINE in nanoseconds
+# ex: BP="-p 1000000000"
+BP="-p 1000000000"
+
+# Runtime parameter for SCHED_DEADLINE in nanoseconds
+# ex: BR="-r 20000"
+BR="-r 20000"
+
+# Duration parameter for SCHED_DEADLINE in seconds
+# ex: BD="-d 3"
+BD="-d 3"
+
+# Starving Threshold in seconds
+# this value the time the thread must be kept ready but not
+# actually run to decide that the thread is starving
+# ex: THRESH="-t 60"
+THRESH="-t 60"
+
+# Logging options
+#
+# Set logging to be some combination of:
+#     --log_only
+#     --log_kmsg
+#     --log_syslog
+#     or Nothing (default)
+# ex: LOGONLY=--log_only
+LOGGING=
+
+# Run in the foreground
+# ex: FG=--foreground
+# note: when using this should change the service Type to be simple
+FG=
diff --git a/redhat/starvation_monitor.service b/redhat/starvation_monitor.service
new file mode 100644
index 0000000..d20f871
--- /dev/null
+++ b/redhat/starvation_monitor.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Starvation Monitor
+
+[Service]
+# Type=simple
+Type=forking
+EnvironmentFile=/etc/systemd/starvation_monitor.conf
+ExecStart=/usr/bin/starvation_monitor $CLIST $AGGR $BP $BR $BD $THRESH $LOGGING $FG
+
+[Install]
+WantedBy=multi-user.target
diff --git a/redhat/starvation_monitor.spec b/redhat/starvation_monitor.spec
index a03a5c0..33aab67 100644
--- a/redhat/starvation_monitor.spec
+++ b/redhat/starvation_monitor.spec
@@ -26,14 +26,23 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%make_install
-
+#%make_install
+make DESTDIR=$RPM_BUILD_ROOT install
+make DESTDIR=$RPM_BUILD_ROOT -C redhat install
 
 %files
 /usr/bin/%{name}
+/etc/systemd/starvation_monitor.conf
+/etc/systemd/system/starvation_monitor.service
 %doc /usr/share/%{name}-%{version}/README.md
 
 
 %changelog
+* Thu Aug 20 2020 williams@redhat.com
+- Added systemd service to redhat subdirectory
+- added make and rpm logic for systemd files
+
 * Wed Aug 19 2020 williams@redhat.com
--
+- initial version of specfile
+- Makefile mods for RPM builds
+- added systemd service and config files