diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-12-24 11:06:22 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-12-24 11:06:22 +0000 |
commit | bde7f799bbcb7b8d926207db4578983e7f2b8cbe (patch) | |
tree | 6948950a0373c8f57c3b59fd5371efc7b25d5edc /main/slony1/slony1.initd | |
parent | 335132a950b4bf6df52d8c064070af7ce55dfc20 (diff) | |
download | aports-bde7f799bbcb7b8d926207db4578983e7f2b8cbe.tar.bz2 aports-bde7f799bbcb7b8d926207db4578983e7f2b8cbe.tar.xz |
main/slony1: fix logrotation
we fix logrotation by only supporting syslog and not redirect the slon
output to a given logfile.
This is becase when redirecting, the only way to do log rotation is restart
the service to reopen the log file. We do not want force restart of service
which will close open connections.
Diffstat (limited to 'main/slony1/slony1.initd')
-rw-r--r--[-rwxr-xr-x] | main/slony1/slony1.initd | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/main/slony1/slony1.initd b/main/slony1/slony1.initd index 4f1469dc64..132aa1ebe0 100755..100644 --- a/main/slony1/slony1.initd +++ b/main/slony1/slony1.initd @@ -1,37 +1,41 @@ #!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/slony1/files/slony1.init,v 1.2 2007/03/07 23:18:21 nakano Exp $ + +pidfile=/var/run/slony/slony1.pid +command=/usr/bin/slon +config=/etc/slon.conf depend() { - need postgresql + need postgresql net + after firewall } -start() { - ebegin "Starting slony1" - /usr/bin/slon -p /var/run/slony1.pid -d $LOGLEVEL $CLUSTER "dbname=$DBNAME user=$DBUSER host=$DBHOST" >> $LOGFILE 2>&1 & - - while : - do - cnt=$(($cnt + 1)) - if [ -f "/var/run/slony1.pid" ]; then - ret=0 - break - fi - - if [ $cnt -eq 30 ]; then - eerror "Please see log file: $LOGFILE" - ret=1 - break - fi - sleep 1 - done - eend $ret +start_pre() { + checkpath --directory ${pidfile%/*} + if ! [ -e "$config" ]; then + eerror "config file $config is missing" + return 1 + fi + if [ -n "$LOGFILE" ]; then + ewarn "LOGFILE in /etc/conf.d/slony1 is ignored. Only syslog is supported." + fi + if [ -n "$LOGLEVEL" ]; then + ewarn "LOGLEVEL in /etc/conf.d/slony1 is ignored." + fi } -stop() { - ebegin "Stopping slony1" - kill `cat /var/run/slony1.pid` +start() { + ebegin "Starting slony1" + if [ -n "$CLUSTER" ]; then + set -- $CLUSTER "dbname=$DBNAME user=$DBUSER host=$DBHOST" + fi + start-stop-daemon --exec $command \ + --pidfile "$pidfile" \ + --background \ + --wait 100 \ + -- \ + -p "$pidfile" \ + -f "$config" \ + "$@" eend $? } |