1# ==== Usage ====
2#
3# [--let $shutdown_timeout= 60]
4# [--let $allow_rpl_inited= 1]
5# --source include/shutdown_mysqld.inc
6
7# The default value is empty
8--let $server_shutdown_timeout=
9
10if ($shutdown_timeout)
11{
12  --let $server_shutdown_timeout= $shutdown_timeout
13}
14
15# This is the first half of include/restart_mysqld.inc.
16if ($rpl_inited)
17{
18  if (!$allow_rpl_inited)
19  {
20    --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc
21  }
22}
23
24# Write file to make mysql-test-run.pl expect the "crash", but don't start it
25--let $_server_id= `SELECT @@server_id`
26--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
27--exec echo "wait" > $_expect_file_name
28
29--let $server_shutdown_timeout= 60
30if ($shutdown_timeout)
31{
32  --let $server_shutdown_timeout= $shutdown_timeout
33}
34if ($shutdown_timeout == 0)
35{
36  --let $server_shutdown_timeout= 0
37}
38
39# Send shutdown to the connected server
40--shutdown_server $server_shutdown_timeout
41--source include/wait_until_disconnected.inc
42
43