Ubuntu Upstart脚本没有';我不知道mysql服务

Ubuntu Upstart脚本没有';我不知道mysql服务,ubuntu,init,mariadb,upstart,Ubuntu,Init,Mariadb,Upstart,我将创建upstart脚本,它将在关闭之前刷新数据库中的脏页。我使用Ubuntu 14.04和MariaDB。我使用以下命令启动upstart脚本: start on stopping mysql script [something] end script 但脚本返回: start: Unknown job: on Script started, file is typescript 但脚本什么都不做。。。我哪里有错?有人能帮我吗?Ths;) 脚本: # # mysql-shutd

我将创建upstart脚本,它将在关闭之前刷新数据库中的脏页。我使用Ubuntu 14.04和MariaDB。我使用以下命令启动upstart脚本:

start on stopping mysql

script
    [something]
end script
但脚本返回:

start: Unknown job: on
Script started, file is typescript
但脚本什么都不做。。。我哪里有错?有人能帮我吗?Ths;)

脚本:

#
# mysql-shutdown - This script clean innodb dirty pages
# from: http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/
#

start on stopping mysql
console output

script
    echo "Mysql-shutdown script start:"
    pct=0

    # Call the given function, require that it complete successfully, and then
    # return the status.
    rcall() {
        echo -n '+'
        echo -n $@
        $@
        status=$?

        if [ $status != 0 ]; then
            echo " FAILED"
            exit $status
        fi

        echo
        return $status
    }

    if [ "$1" = "--allow_dirty_buffers" ]; then
        pct=90
    fi

    innodb_status=$(echo "SHOW ENGINES;" | rcall mysql --user=root | grep InnoDB | cut -f2)
    if [ "$innodb_status" = "DISABLED" ]; then
        echo "The Innodb storage engine is disabled"
        exit 0
    fi

    # tell mysql that we need to shutdown so start flushing dirty pages to disk.
    # Normally InnoDB does this by itself but only when port 3306 is closed which
    # prevents us from monitoring the box.
    rcall mysql --user=root << EOF
    SLAVE STOP;
    SET GLOBAL innodb_max_dirty_pages_pct=$pct;
    EOF

    # ..... how wait until the dirty buffer size goes down to zero.
    IFS=
    if [ "$1" = "--progress" ]; then
        echo "Innodb dirty pages:"
        while [ true ]; do
            status=$(echo 'SHOW INNODB STATUS\G' | rcall mysql --user=root)
            modified_db_pages=$(echo $status | grep -E '^Modified db pages' | grep -Eo '[0-9]+$')

            if [ "$modified_db_pages" = "0" ]; then
                echo
                break
            fi

            echo -ne "$modified_db_pages\r";
            sleep 1
        done
    fi
end script
#
#mysql关机-此脚本清除innodb脏页
#发件人:http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/
#
开始停止mysql
控制台输出
剧本
echo“Mysql关闭脚本启动:”
pct=0
#调用给定的函数,要求它成功完成,然后
#返回状态。
rcall(){
回声-n'+'
回声-n$@
$@
状态=$?
如果[$status!=0];则
回显“失败”
退出$status
fi
回响
返回$status
}
如果[“$1”=”--允许脏缓冲区”];然后
pct=90
fi
innodb|u status=$(echo“SHOW ENGINES;”rcall mysql--user=root | grep innodb | cut-f2)
如果[“$innodb_status”=“DISABLED”];然后
echo“Innodb存储引擎已禁用”
出口0
fi
#告诉mysql我们需要关闭,所以开始将脏页刷新到磁盘。
#通常InnoDB会自行执行此操作,但只有在端口3306关闭时才会执行此操作
#阻止我们监视该框。

rcall mysql--user=root脚本部分是问题所在,您需要向我们展示它。