Tue, 28 Aug 2012 18:29:00 +0200
Massively update modules from Drupal 6.x to 7.x, and add diverse OpenID modules.
Unfortunately many modules available to Drupal 6.x installations have not been
since maintained or ported to 7.x causing this package to diminish in both size
and utility.
michael@300 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@300 | 2 | ## |
michael@300 | 3 | ## rc.postgresql -- Run-Commands |
michael@300 | 4 | ## |
michael@300 | 5 | |
michael@300 | 6 | %config |
michael@300 | 7 | postgresql_enable="$openpkg_rc_def" |
michael@300 | 8 | postgresql_flags="" |
michael@300 | 9 | postgresql_datadir="@l_prefix@/var/postgresql/db" |
michael@300 | 10 | postgresql_rundir="@l_prefix@/var/postgresql/run" |
michael@300 | 11 | postgresql_shut_mode="fast" |
michael@300 | 12 | postgresql_socket_inet="127.0.0.1" |
michael@300 | 13 | postgresql_socket_unix="@l_prefix@/var/postgresql/run" |
michael@300 | 14 | postgresql_log_prolog="true" |
michael@300 | 15 | postgresql_log_epilog="true" |
michael@300 | 16 | postgresql_log_numfiles="10" |
michael@300 | 17 | postgresql_log_minsize="1M" |
michael@300 | 18 | postgresql_log_complevel="9" |
michael@300 | 19 | postgresql_slony1="no" |
michael@300 | 20 | |
michael@300 | 21 | %common |
michael@300 | 22 | postgresql_opts="-h $postgresql_socket_inet -k $postgresql_socket_unix" |
michael@300 | 23 | postgresql_opts="$postgresql_opts $postgresql_flags" |
michael@300 | 24 | postgresql_logfile="$postgresql_rundir/postgresql.log" |
michael@300 | 25 | postgresql_pidfile="$postgresql_datadir/postgresql.pid" |
michael@300 | 26 | postgresql_slony1_pidfile="$postgresql_rundir/slon.pid" |
michael@300 | 27 | postgresql_slony1_start () { |
michael@300 | 28 | ( . @l_prefix@/etc/postgresql/slony1.conf |
michael@300 | 29 | nohup @l_prefix@/bin/slon \ |
michael@300 | 30 | -d "$SLON_SYNC_LOGLEVEL" -g "$SLON_SYNC_GROUPSIZE" \ |
michael@300 | 31 | -s "$SLON_SYNC_INTERVAL" -t "$SLON_SYNC_TIMEOUT" \ |
michael@300 | 32 | "$SLON_CLUSTER_NAME" \ |
michael@300 | 33 | user="$SLON_CONNECT_USER" password="$SLON_CONNECT_PASS" \ |
michael@300 | 34 | dbname="$SLON_CONNECT_DBNAME" host="$SLON_CONNECT_HOST" |
michael@300 | 35 | </dev/null >/dev/null 2>&1 & |
michael@300 | 36 | echo $! >$postgresql_slony1_pidfile |
michael@300 | 37 | ) >/dev/null 2>&1 |
michael@300 | 38 | } |
michael@300 | 39 | postgresql_slony1_stop () { |
michael@300 | 40 | if [ -f $postgresql_slony1_pidfile ]; then |
michael@300 | 41 | kill -TERM `cat $postgresql_slony1_pidfile` |
michael@300 | 42 | rm -f $postgresql_slony1_pidfile |
michael@300 | 43 | fi |
michael@300 | 44 | } |
michael@300 | 45 | postgresql_ctl () { |
michael@300 | 46 | if [ -s $postgresql_pidfile ]; then |
michael@300 | 47 | kill -0 `head -1 $postgresql_pidfile` >/dev/null 2>&1 |
michael@300 | 48 | if [ $? -ne 0 ]; then |
michael@300 | 49 | rm -f $postgresql_pidfile >/dev/null 2>&1 || true |
michael@300 | 50 | rm -f $postgresql_rundir/.s* >/dev/null 2>&1 || true |
michael@300 | 51 | fi |
michael@300 | 52 | fi |
michael@300 | 53 | cmd="$1"; shift |
michael@300 | 54 | @l_prefix@/bin/pg_ctl $cmd \ |
michael@300 | 55 | -l $postgresql_logfile \ |
michael@300 | 56 | -D $postgresql_datadir \ |
michael@300 | 57 | ${1+"$@"} |
michael@300 | 58 | } |
michael@300 | 59 | |
michael@300 | 60 | %status -u @l_rusr@ -o |
michael@300 | 61 | postgresql_usable="unknown" |
michael@300 | 62 | postgresql_active="no" |
michael@300 | 63 | rcService postgresql enable yes && \ |
michael@300 | 64 | postgresql_ctl status >/dev/null && \ |
michael@300 | 65 | postgresql_active="yes" |
michael@300 | 66 | echo "postgresql_enable=\"$postgresql_enable\"" |
michael@300 | 67 | echo "postgresql_usable=\"$postgresql_usable\"" |
michael@300 | 68 | echo "postgresql_active=\"$postgresql_active\"" |
michael@300 | 69 | |
michael@300 | 70 | %start -p 400 -u @l_rusr@ |
michael@300 | 71 | rcService postgresql enable yes || exit 0 |
michael@300 | 72 | rcService postgresql active yes && exit 0 |
michael@300 | 73 | postgresql_ctl start -o "$postgresql_opts" |
michael@300 | 74 | if rcVarIsYes postgresql_slony1; then |
michael@300 | 75 | postgresql_slony1_start |
michael@300 | 76 | fi |
michael@300 | 77 | |
michael@300 | 78 | %stop -p 600 -u @l_rusr@ |
michael@300 | 79 | rcService postgresql enable yes || exit 0 |
michael@300 | 80 | rcService postgresql active no && exit 0 |
michael@300 | 81 | postgresql_ctl stop -m "$postgresql_shut_mode" |
michael@300 | 82 | if rcVarIsYes postgresql_slony1; then |
michael@300 | 83 | postgresql_slony1_stop |
michael@300 | 84 | fi |
michael@300 | 85 | |
michael@300 | 86 | %restart -p 400 -u @l_rusr@ |
michael@300 | 87 | rcService postgresql enable yes || exit 0 |
michael@300 | 88 | rcService postgresql active no && exit 0 |
michael@300 | 89 | postgresql_ctl restart -o "$postgresql_opts" -m "$postgresql_shut_mode" |
michael@300 | 90 | if rcVarIsYes postgresql_slony1; then |
michael@300 | 91 | postgresql_slony1_stop |
michael@300 | 92 | postgresql_slony1_start |
michael@300 | 93 | fi |
michael@300 | 94 | |
michael@300 | 95 | %reload -p 400 -u @l_rusr@ |
michael@300 | 96 | rcService postgresql enable yes || exit 0 |
michael@300 | 97 | rcService postgresql active no && exit 0 |
michael@300 | 98 | postgresql_ctl reload |
michael@300 | 99 | |
michael@300 | 100 | %daily -u @l_rusr@ |
michael@300 | 101 | rcService postgresql enable yes || exit 0 |
michael@300 | 102 | shtool rotate -f \ |
michael@300 | 103 | -n ${postgresql_log_numfiles} -s ${postgresql_log_minsize} -d -c \ |
michael@300 | 104 | -z ${postgresql_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \ |
michael@300 | 105 | -P "$postgresql_log_prolog" \ |
michael@300 | 106 | -E "$postgresql_log_epilog" \ |
michael@300 | 107 | $postgresql_logfile |
michael@300 | 108 |