~knielsen/ourdelta/bug_484127_484120_2

« back to all changes in this revision

Viewing changes to bakery/debian-5.1/mysql-server-5.1.mysql-ndb.init

  • Committer: Arjen Lentz
  • Date: 2009-10-28 03:20:03 UTC
  • mfrom: (54.4.30 ourdelta-mariadb51-2)
  • Revision ID: arjen@openquery.com-20091028032003-3ebv58q8zin6xxbd
Merge from 5.1 bakery branch
Made autobake-deb.sh from 5.1 branch into separate autobake51-deb.sh (nasty merge)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
#
3
 
### BEGIN INIT INFO
4
 
# Provides:          mysql-ndb
5
 
# Required-Start:    $remote_fs $syslog mysql-ndb-mgm
6
 
# Required-Stop:     $remote_fs $syslog mysql-ndb-mgm
7
 
# Should-Start:      $network $named $time
8
 
# Should-Stop:       $network $named $time
9
 
# Default-Start:     2 3 4 5
10
 
# Default-Stop:      0 1 6
11
 
# Short-Description: Start and stop the mysql database cluster server daemon
12
 
# Description:       Controls the MySQL NDB Data Node daemon "ndbd".
13
 
### END INIT INFO
14
 
#
15
 
set -e
16
 
set -u
17
 
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
18
 
 
19
 
# Variables
20
 
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
21
 
DAEMON=/usr/sbin/ndbd
22
 
CONF=/etc/mysql/my.cnf
23
 
export HOME=/etc/mysql/
24
 
 
25
 
# Safeguard (relative paths, core dumps..)
26
 
cd /
27
 
umask 077
28
 
 
29
 
# Exit *silently* if we're not supposed to be started.
30
 
#
31
 
# The Debian scripts should execute these scripts to stop and start
32
 
# the daemon when upgrading if it is started. On the other hand it should
33
 
# remain silently if the server has not even been configured.
34
 
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
35
 
test -x $DAEMON || exit 0
36
 
if $DAEMON --help | grep -q '^ndb-connectstring.*No default value'; then exit 0; fi
37
 
. /lib/lsb/init-functions
38
 
 
39
 
#
40
 
# main()
41
 
#
42
 
case "${1:-''}" in
43
 
  'start')
44
 
        # Start daemon
45
 
        # Creatign a PID file does not work as the master process forks
46
 
        # a child with different PID and then terminates itself.
47
 
        log_daemon_msg "Starting MySQL NDB Data Node" "ndbd"
48
 
        if start-stop-daemon \
49
 
                --start \
50
 
                --exec $DAEMON \
51
 
                --user mysql
52
 
        then
53
 
          log_end_msg 0
54
 
        else
55
 
          log_end_msg 1
56
 
          log_warning_msg "Please take a look at the syslog."
57
 
          exit 1
58
 
        fi                        
59
 
        ;;
60
 
 
61
 
  'start-initial')
62
 
        # Perform an initial start of ndbd
63
 
        log_daemon_msg "Initial start of MySQL NDB Data Node" "ndbd"
64
 
        if start-stop-daemon \
65
 
                --start \
66
 
                --exec $DAEMON \
67
 
                --user mysql \
68
 
                -- --initial
69
 
        then
70
 
          log_end_msg 0
71
 
        else
72
 
          log_end_msg 1
73
 
          log_warning_msg "Please take a look at the syslog."
74
 
          exit 1
75
 
        fi  
76
 
        ;;
77
 
 
78
 
  'stop')
79
 
        log_daemon_msg "Stopping MySQL NDB Data Node" "ndbd"    
80
 
        if start-stop-daemon \
81
 
                --stop \
82
 
                --oknodo \
83
 
                --exec $DAEMON
84
 
        then
85
 
          log_end_msg 0
86
 
        else
87
 
          log_end_msg 1
88
 
          exit 1
89
 
        fi
90
 
        ;;
91
 
 
92
 
  'restart'|'force-reload')
93
 
        set +e; $SELF stop; set -e
94
 
        $SELF start 
95
 
        ;;
96
 
 
97
 
  *)
98
 
        echo "Usage: $SELF start|start-initial|stop|restart|force-reload"
99
 
        echo " * start-initial starts ndbd with '--initial'"
100
 
        exit 1
101
 
        ;;
102
 
esac
103