aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2010-10-11 22:39:01 +0200
committerChristian Ruppert <idl0r@gentoo.org>2010-10-11 22:39:01 +0200
commite1b40351e6de60fa39f0b7d4e6268ddceeffe92f (patch)
tree190feb3862bb18c2fc4336cfc3b0d2c8835db97b
parentRename everything from squid-cronolog to fifo-cronolog. (diff)
downloadfifo-cronolog-e1b40351e6de60fa39f0b7d4e6268ddceeffe92f.tar.gz
fifo-cronolog-e1b40351e6de60fa39f0b7d4e6268ddceeffe92f.tar.bz2
fifo-cronolog-e1b40351e6de60fa39f0b7d4e6268ddceeffe92f.zip
Create the fifo inside of the init script.
-rw-r--r--fifo-cronolog.confd3
-rw-r--r--fifo-cronolog.initd12
2 files changed, 15 insertions, 0 deletions
diff --git a/fifo-cronolog.confd b/fifo-cronolog.confd
index 9eec589..a73e291 100644
--- a/fifo-cronolog.confd
+++ b/fifo-cronolog.confd
@@ -1,6 +1,9 @@
# Various paths:
PIDFILE="/var/run/fifo-cronolog.pid"
FIFO="/var/lib/fifo-cronolog.fifo"
+# User/Group of the fifo owner, will be set during startup if the fifo doesn't exist already
+FIFO_OWNER="root:root"
+FIFO_PERMS="0600"
LOGS="/var/log/fifo-cronolog/transfer/%Y%m%d.log"
# Uncomment and add the service name you want to use it for to ensure
diff --git a/fifo-cronolog.initd b/fifo-cronolog.initd
index e04b272..b5a637e 100644
--- a/fifo-cronolog.initd
+++ b/fifo-cronolog.initd
@@ -5,6 +5,18 @@
start() {
ebegin "Starting fifo-cronolog"
+
+ if [ ! -e "${FIFO}" ]; then
+ mkfifo $FIFO || eend $?
+ fi
+ if [ -p "${FIFO}" ]; then
+ chown $FIFO_OWNER $FIFO || eend $?
+ chmod $FIFO_PERMS $FIFO || eend $?
+ else
+ eerror "${FIFO} is not a valid FIFO!"
+ eend 1
+ fi
+
start-stop-daemon --start --exec /usr/sbin/fifo-cronolog \
--pidfile "${PIDFILE}" -- "${PIDFILE}" "${FIFO}" "${LOGS}"
eend $?