SHA256
1
0
forked from pool/rrdtool
rrdtool/rrdcached-systemd-pre
Denisart Benjamin 786c95fae1 Accepting request 201898 from home:jsjhb:branches:devel:languages:python
- add rrdtools-cached package including systemd service
- add full documentation (txt, html)
- clean up the ruby header workaround using site install

OBS-URL: https://build.opensuse.org/request/show/201898
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=43
2013-10-03 14:16:18 +00:00

46 lines
1.4 KiB
Bash

#!/bin/sh
#
# script to create the file system environment for rrdcached
# from rrdtool package. This is needed, as openSUSE >= 13.1
# enforces use of systemd, and does not allow the old-style
# init.d script.
# Hence, the content here is shamelessly ripped from the
# init.d script.
#
# Check for existence of needed config file and read it
RRDCACHED_CONFIG='/etc/sysconfig/rrdcached'
test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid'
# Read config
. $RRDCACHED_CONFIG
function check_and_create_dir(){
local DIR=$1
test -d "$DIR" || mkdir -p "$DIR"
}
check_and_create_dir "$(dirname $RRDCACHED_PID)"
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)"
case "$RRDCACHED_ADDRESS" in
^unix:)
SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/})
check_and_create_dir "$SOCKETDIR"
chgrp $RRDCACHED_GROUP "$SOCKETDIR"
;;
esac
case "$RRDCACHED_CHROOT_DIR" in
/tmp)
echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2
;;
*)
check_and_create_dir "$RRDCACHED_CHROOT_DIR"
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR"
;;
esac