rrdtool/rrdcached-systemd-pre
Denisart Benjamin d1186b3013 Accepting request 221484 from home:jsjhb:branches:devel:languages:python
- again fix PIDfile handling for rrdcached in systemd file
  (ugly now: because of removal of declaration in sysconfig file;
  it has to be declared twice in service file)
- add PIDfile directory using tmpfiles now

OBS-URL: https://build.opensuse.org/request/show/221484
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=55
2014-02-09 19:33:54 +00:00

42 lines
1.2 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; }
# Read config
. $RRDCACHED_CONFIG
function check_and_create_dir(){
local DIR=$1
test -d "$DIR" || mkdir -p "$DIR"
}
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