~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to support-files/mysql.server.sh

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-04-02 16:10:53 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070402161053-zkil9hjq9k5p1uzv
Tags: 5.0.37-0ubuntu1
* New upstream bugfix release.
  - Fixes replication failure with auto-increment and on duplicate key
    update, a regression introduced into 5.0.24. (LP: #95821)
* debian/control: Set Ubuntu maintainer.
* debian/rules: Change comments from 'Debian etch' to 'Ubuntu 7.04'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
 
144
144
wait_for_pid () {
145
145
  i=0
146
 
  while test $i -lt 35 ; do
 
146
  while test $i -lt 900 ; do
147
147
    sleep 1
148
148
    case "$1" in
149
149
      'created')
150
150
        test -s $pid_file && i='' && break
 
151
        kill -0 $2 || break # if the program goes away, stop waiting
151
152
        ;;
152
153
      'removed')
153
154
        test ! -s $pid_file && i='' && break
163
164
 
164
165
  if test -z "$i" ; then
165
166
    log_success_msg
 
167
    return 0
166
168
  else
167
169
    log_failure_msg
 
170
    return 1
168
171
  fi
169
172
}
170
173
 
277
280
      # Give extra arguments to mysqld with the my.cnf file. This script may
278
281
      # be overwritten at next upgrade.
279
282
      $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 &
280
 
      wait_for_pid created
 
283
      wait_for_pid created $!; return_value=$?
281
284
 
282
285
      # Make lock for RedHat / SuSE
283
286
      if test -w /var/lock/subsys
284
287
      then
285
288
        touch /var/lock/subsys/mysqlmanager
286
289
      fi
 
290
      exit $return_value
287
291
    elif test -x $bindir/mysqld_safe
288
292
    then
289
293
      # Give extra arguments to mysqld with the my.cnf file. This script
290
294
      # may be overwritten at next upgrade.
291
295
      pid_file=$server_pid_file
292
296
      $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
293
 
      wait_for_pid created
 
297
      wait_for_pid created $!; return_value=$?
294
298
 
295
299
      # Make lock for RedHat / SuSE
296
300
      if test -w /var/lock/subsys
297
301
      then
298
302
        touch /var/lock/subsys/mysql
299
303
      fi
 
304
      exit $return_value
300
305
    else
301
306
      log_failure_msg "Couldn't find MySQL manager or server"
302
307
    fi
322
327
      echo $echo_n "Shutting down MySQL"
323
328
      kill $mysqlmanager_pid
324
329
      # mysqlmanager should remove the pid_file when it exits, so wait for it.
325
 
      wait_for_pid removed
 
330
      wait_for_pid removed; return_value=$?
326
331
 
327
332
      # delete lock for RedHat / SuSE
328
333
      if test -f $lock_dir
329
334
      then
330
335
        rm -f $lock_dir
331
336
      fi
 
337
      exit $return_value
332
338
    else
333
339
      log_failure_msg "MySQL manager or server PID file could not be found!"
334
340
    fi
337
343
  'restart')
338
344
    # Stop the service and regardless of whether it was
339
345
    # running or not, start it again.
340
 
    $0 stop  $other_args
341
 
    $0 start $other_args
 
346
    if $0 stop  $other_args; then
 
347
      $0 start $other_args
 
348
    else
 
349
      log_failure_msg "Failed to stop running server, so refusing to try to start."
 
350
      exit 1
 
351
    fi
342
352
    ;;
343
353
 
344
354
  'reload')
357
367
    exit 1
358
368
    ;;
359
369
esac
 
370
 
 
371
exit 0