Related to #657
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
Makefile.am | 6 ++-
init-scripts/abrt-upload-watch | 93 ++++++++++++++++++++++++++++++++++
init-scripts/abrt-upload-watch.service | 10 ++++
3 files changed, 107 insertions(+), 2 deletions(-)
create mode 100644 init-scripts/abrt-upload-watch
create mode 100644 init-scripts/abrt-upload-watch.service
diff --git a/Makefile.am b/Makefile.am
index b56a954..a67659e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,8 @@ if HAVE_SYSTEMD
init-scripts/abrt-oops.service \
init-scripts/abrt-xorg.service \
init-scripts/abrt-vmcore.service \
- init-scripts/abrt-uefioops.service
+ init-scripts/abrt-uefioops.service \
+ init-scripts/abrt-upload-watch.service
else
sysv_initdir = $(sysconfdir)/rc.d/init.d/
sysv_init_SCRIPTS = init-scripts/abrtd \
@@ -48,7 +49,8 @@ else
init-scripts/abrt-oops \
init-scripts/abrt-xorg \
init-scripts/abrt-vmcore \
- init-scripts/abrt-uefioops
+ init-scripts/abrt-uefioops \
+ init-scripts/abrt-upload-watch
endif
RPM_DIRS = --define "_sourcedir `pwd`" \
diff --git a/init-scripts/abrt-upload-watch b/init-scripts/abrt-upload-watch
new file mode 100644
index 0000000..f1d6a04
--- /dev/null
+++ b/init-scripts/abrt-upload-watch
@@ -0,0 +1,93 @@
+#!/bin/bash
+# Watches upload directory and extracts incoming archives into ABRT dump
+# location
+#
+# chkconfig: 35 82 16
+# description: ABRT upload watch
+### BEGIN INIT INFO
+# Provides: abrt-upload-watch
+# Required-Start: $abrtd
+# Default-Stop: 0 1 2 6
+# Default-Start: 3 5
+# Short-Description: ABRT upload watch
+# Description: Extracts incoming ABRT archives into ABRT dump location
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+PROG="abrt-upload-watch"
+LOCKFILE="/var/lock/subsys/$PROG"
+EXEC="/usr/sbin/$PROG"
+
+start() {
+ [ -x $EXEC ] || exit 5
+ echo -n $"Starting '$PROG': "
+ daemon $EXEC -d
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping '$PROG': "
+ killproc $PROG
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status $PROG
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+exit $?
diff --git a/init-scripts/abrt-upload-watch.service
b/init-scripts/abrt-upload-watch.service
new file mode 100644
index 0000000..47ccf71
--- /dev/null
+++ b/init-scripts/abrt-upload-watch.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ABRT upload watcher
+After=abrtd.service
+Requisite=abrtd.service
+
+[Service]
+ExecStart=/usr/sbin/abrt-upload-watch
+
+[Install]
+WantedBy=multi-user.target
--
1.8.3.1