summaryrefslogtreecommitdiff
path: root/src/upstart
diff options
context:
space:
mode:
authorTommi Virtanen <tv@inktank.com>2012-05-17 09:47:33 -0700
committerTommi Virtanen <tv@inktank.com>2012-05-23 14:02:34 -0700
commitf1e4d44d4b6852a8fa5b9a2af07c63c8469ad794 (patch)
tree7a691736cc67cd180306c187524b970a4d30acb5 /src/upstart
parent176a14aef90e7ed0a241f48e5c6667ff1c100e50 (diff)
downloadceph-f1e4d44d4b6852a8fa5b9a2af07c63c8469ad794.tar.gz
upstart: support mds
Closes: #2414 Signed-off-by: Tommi Virtanen <tv@inktank.com>
Diffstat (limited to 'src/upstart')
-rw-r--r--src/upstart/ceph-mds-all.conf26
-rw-r--r--src/upstart/ceph-mds.conf18
2 files changed, 44 insertions, 0 deletions
diff --git a/src/upstart/ceph-mds-all.conf b/src/upstart/ceph-mds-all.conf
new file mode 100644
index 00000000000..776d31118c2
--- /dev/null
+++ b/src/upstart/ceph-mds-all.conf
@@ -0,0 +1,26 @@
+description "Ceph MDS (start all instances)"
+
+start on filesystem
+
+task
+
+script
+ set -e
+ # TODO what's the valid charset for cluster names and mds ids?
+ find /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9]+-[a-z0-9]+' -printf '%P\n' \
+ | while read f; do
+ if [ -e "/var/lib/ceph/mds/$f/done" ]; then
+ cluster="${f%%-*}"
+ id="${f#*-}"
+
+ # upstart start(8) fails if the job is already running
+ # https://bugs.launchpad.net/upstart/+bug/878322
+
+ # also cannot ask for status of instance that isn't running at
+ # that time, so just list all and filter that
+ if initctl list|mawk '$1=="ceph-mds" && $2=="(" CLUSTER "/" INSTANCE ")" && $3~/start\// { exit 1 }' CLUSTER="$cluster" INSTANCE="$id"; then
+ start ceph-mds cluster="$cluster" id="$id"
+ fi
+ fi
+ done
+end script
diff --git a/src/upstart/ceph-mds.conf b/src/upstart/ceph-mds.conf
new file mode 100644
index 00000000000..2438a975b07
--- /dev/null
+++ b/src/upstart/ceph-mds.conf
@@ -0,0 +1,18 @@
+description "Ceph MDS"
+
+stop on runlevel [!2345]
+
+respawn
+respawn limit 5 30
+
+pre-start script
+ set -e
+ test -x /usr/bin/ceph-mds || { stop; exit 0; }
+ test -d "/var/lib/ceph/mds/${cluster:-ceph}-$id" || { stop; exit 0; }
+
+ install -d -m0755 /var/run/ceph
+end script
+
+instance ${cluster:-ceph}/$id
+
+exec /usr/bin/ceph-mds --cluster="${cluster:-ceph}" -i "$id" -f