~gl-az/+junk/scripts

« back to all changes in this revision

Viewing changes to imtr/imtr.serverrun.sh

  • Committer: George O. Lorch III
  • Date: 2013-01-29 18:27:00 UTC
  • mfrom: (24.1.2 scripts)
  • Revision ID: george.lorch@percona.com-20130129182700-9yqozic74ff4qyty
Merged changes from path

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        fi
47
47
 
48
48
        imtr_report -n "Starting server instance $instanceid with ${S_MYSQLD_OPTIONS[$instanceid]}..."
49
 
        imtr_runcmd ${S_MYSQLD[$instanceid]} ${S_MYSQLD_OPTIONS[$instanceid]} &> ${S_LOGFILE[$instanceid]} &
50
 
        S_PID[$instanceid]="$!"
51
 
        while [ ! -z "`ps -p ${S_PID[$instanceid]} -o cmd --no-headers`" ] \
 
49
        ( PATH=${S_BINDIR[$instanceid]}/bin:$PATH; \
 
50
                mysqld \
 
51
                        --defaults-file=${S_DEFAULTSFILE[$instanceid]} \
 
52
                        &> ${S_LOGFILE[$instanceid]} ) &
 
53
 
 
54
        local pid="$!"
 
55
        while [ ! -z "`ps -p ${pid} -o cmd --no-headers`" ] \
52
56
           && [ ! -e "${S_SOCKET[$instanceid]}" ]; do
53
57
                sleep 1
54
58
                imtr_report -n "."
55
59
        done
56
 
        if ps -p "${S_PID[$instanceid]}" -o cmd --no-headers && [ -e "${S_SOCKET[$instanceid]}" ]; then
 
60
        if ps -p "${pid}" -o cmd --no-headers && [ -e "${S_SOCKET[$instanceid]}" ]; then
 
61
                S_PID[$instanceid]=`cat ${S_PIDFILE[$instanceid]}`
57
62
                imtr_report "started as PID ${S_PID[$instanceid]} on port ${S_PORT[$instanceid]} and socket ${S_SOCKET[$instanceid]}"
58
63
        else
59
64
                imtr_error "failed to start."
94
99
                S_PID[$instanceid]=
95
100
        else
96
101
                imtr_report -n "Stopping server instance $instanceid running as PID ${S_PID[$instanceid]}..."
97
 
                imtr_runcmd ${S_MYSQLADMIN[$instanceid]} ${S_MYSQL_OPTIONS[$instanceid]} shutdown
 
102
                ( PATH=${S_BINDIR[$instanceid]}/bin:$PATH; \
 
103
                        mysqladmin --defaults-file=${S_DEFAULTSFILE[$instanceid]} shutdown )
98
104
                imtr_report "stopped."
99
105
                S_PID[$instanceid]=
100
106
        fi