ceph: remove ceph user and disable systemd services
[pti/rtp.git] / meta-stx / recipes-extended / ceph / files / ceph.sh
1 #!/bin/bash
2
3 INITDIR=/etc/init.d
4 LOGFILE=/var/log/ceph/ceph-init.log
5 CEPH_FILE=/var/run/.ceph_started
6
7 # Get our nodetype
8 . /etc/platform/platform.conf
9
10 # Exit immediately if ceph not configured (i.e. no mon in the config file)
11 if ! grep -q "mon\." /etc/ceph/ceph.conf
12 then
13     exit 0
14 fi
15
16 logecho ()
17 {
18     echo $1
19     date >> ${LOGFILE}
20     echo $1 >> ${LOGFILE}
21 }
22
23 start ()
24 {
25     logecho "Starting ceph services..."
26     ${INITDIR}/ceph start >> ${LOGFILE} 2>&1
27     RC=$?
28
29     if [ ! -f ${CEPH_FILE} ]; then
30         touch ${CEPH_FILE}
31     fi
32 }
33
34 stop ()
35 {
36     if [[ "$system_type" == "All-in-one" ]] && [[ "$system_mode" == "simplex" ]]; then
37         logecho "Ceph services will continue to run on node"
38         exit 0
39     fi
40
41     logecho "Stopping ceph services..."
42
43     if [ -f ${CEPH_FILE} ]; then
44         rm -f ${CEPH_FILE}
45     fi
46
47     ${INITDIR}/ceph stop >> ${LOGFILE} 2>&1
48     RC=$?
49 }
50
51 RC=0
52
53 case "$1" in
54     start)
55         start
56         ;;
57     stop)
58         stop
59         ;;
60     *)
61         echo "Usage: $0 {start|stop}"
62         exit 1
63         ;;
64 esac
65
66 logecho "RC was: $RC"
67 exit $RC