summaryrefslogtreecommitdiff
path: root/dev-db/ctdb/files/ctdb.initd
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-db/ctdb/files/ctdb.initd
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-db/ctdb/files/ctdb.initd')
-rw-r--r--dev-db/ctdb/files/ctdb.initd81
1 files changed, 81 insertions, 0 deletions
diff --git a/dev-db/ctdb/files/ctdb.initd b/dev-db/ctdb/files/ctdb.initd
new file mode 100644
index 000000000000..ca96019e22b1
--- /dev/null
+++ b/dev-db/ctdb/files/ctdb.initd
@@ -0,0 +1,81 @@
+#!/sbin/runscript
+
+depend() {
+ need localmount
+ need net
+ before samba
+ after bootmisc
+}
+
+start() {
+ ebegin "Starting ctdb"
+
+ [ -z "$CTDB_RECOVERY_LOCK" ] && {
+ eerror "You must configure the location of the CTDB_RECOVERY_LOCK in /etc/conf.d/ctdb"
+ return 1
+ }
+
+ [ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
+ eerror "You must configure the location of the CTDB_PUBLIC_ADDRESSES in /etc/conf.d/ctdb"
+ return 1
+ }
+
+ [ -z "$CTDB_PUBLIC_INTERFACE" ] && {
+ eerror "You must configure the location of the CTDB_PUBLIC_INTERFACE in /etc/conf.d/ctdb"
+ return 1
+ }
+
+ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
+
+ # build up CTDB_OPTIONS variable from optional parameters
+ [ -z "$CTDB_LOGFILE" ] || CTDB_OPTIONS="$CTDB_OPTIONS --logfile=$CTDB_LOGFILE"
+ [ -z "$CTDB_NODES" ] || CTDB_OPTIONS="$CTDB_OPTIONS --nlist=$CTDB_NODES"
+ [ -z "$CTDB_SOCKET" ] || CTDB_OPTIONS="$CTDB_OPTIONS --socket=$CTDB_SOCKET"
+ [ -z "$CTDB_PUBLIC_ADDRESSES" ] || CTDB_OPTIONS="$CTDB_OPTIONS --public-addresses=$CTDB_PUBLIC_ADDRESSES"
+ [ -z "$CTDB_PUBLIC_INTERFACE" ] || CTDB_OPTIONS="$CTDB_OPTIONS --public-interface=$CTDB_PUBLIC_INTERFACE"
+ [ -z "$CTDB_SINGLE_PUBLIC_IP" ] || CTDB_OPTIONS="$CTDB_OPTIONS --single-public-ip=$CTDB_SINGLE_PUBLIC_IP"
+ [ -z "$CTDB_DBDIR" ] || CTDB_OPTIONS="$CTDB_OPTIONS --dbdir=$CTDB_DBDIR"
+ [ -z "$CTDB_DBDIR_PERSISTENT" ] || CTDB_OPTIONS="$CTDB_OPTIONS --dbdir-persistent=$CTDB_DBDIR_PERSISTENT"
+ [ -z "$CTDB_EVENT_SCRIPT_DIR" ] || CTDB_OPTIONS="$CTDB_OPTIONS --event-script-dir $CTDB_EVENT_SCRIPT_DIR"
+ [ -z "$CTDB_TRANSPORT" ] || CTDB_OPTIONS="$CTDB_OPTIONS --transport $CTDB_TRANSPORT"
+ [ -z "$CTDB_DEBUGLEVEL" ] || CTDB_OPTIONS="$CTDB_OPTIONS -d $CTDB_DEBUGLEVEL"
+ [ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
+ }
+ [ -z "$CTDB_CAPABILITY_RECMASTER" ] || [ "$CTDB_CAPABILITY_RECMASTER" != "no" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --no-recmaster"
+ }
+ [ -z "$CTDB_CAPABILITY_LMASTER" ] || [ "$CTDB_CAPABILITY_LMASTER" != "no" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster"
+ }
+ [ -z "$CTDB_LVS_PUBLIC_IP" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --lvs"
+ }
+ [ -z "$CTDB_SCRIPT_LOG_LEVEL" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --script-log-level=$CTDB_SCRIPT_LOG_LEVEL"
+ }
+
+ # check all persistent databases that they look ok
+ PERSISTENT_DB_DIR="/var/ctdb/persistent"
+ [ -z "$CTDB_DBDIR" ] || {
+ PERSISTENT_DB_DIR="$CTDB_DBDIR/persistent"
+ }
+ mkdir -p $PERSISTENT_DB_DIR 2>/dev/null
+ for PDBASE in `ls $PERSISTENT_DB_DIR/*.tdb.[0-9] 2>/dev/null`; do
+ /usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
+ eerror "Persistent database $PDBASE is corrupted! CTDB will not start."
+ return 1
+ }
+ done
+
+ start-stop-daemon --start --background --exec /usr/sbin/ctdbd \
+ --pidfile /var/run/ctdbd.pid -- $CTDB_OPTIONS
+ eend $?
+
+}
+
+stop() {
+ start-stop-daemon --stop --exec /usr/sbin/ctdbd \
+ --pidfile /var/run/ctdbd.pid
+}
+