学了一招

mysql启动脚本在启动的时候会提示 [ OK ] 或 [ FAILD ].

 

一直不知道是怎么弄的..今天需要写个启动脚本..仔细研究了下mysql的启动脚本..原来就是下面的代码实现

#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
  . $lsb_functions
else
  log_success_msg()
  {
    echo " SUCCESS! $@"
  }
  log_failure_msg()
  {
    echo " ERROR! $@"
  }
fi
查看"/lib/lsb/init-functions"文件..原来是调用的系统脚本.

/lib/lsb/init-functions文件的所有内容如下

#!/bin/sh

# LSB initscript functions, as defined in the LSB Spec 1.1.0
#
# Lawrence Lim <[email protected]> - Tue, 26 June 2007
# Updated to the latest LSB 3.1 spec
# http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic_lines.txt

start_daemon () {
        /etc/redhat-lsb/lsb_start_daemon "$@"
}
killproc () {
        /etc/redhat-lsb/lsb_killproc "$@"
}
pidofproc () {
        /etc/redhat-lsb/lsb_pidofproc "$@"
}
log_success_msg () {
        /etc/redhat-lsb/lsb_log_message success "$@"
}
log_failure_msg () {
        /etc/redhat-lsb/lsb_log_message failure "$@"
}
log_warning_msg () {
        /etc/redhat-lsb/lsb_log_message warning "$@"
}
直接执行'/etc/redhat-lsb/lsb_log_message success "$@"'能得到同样的结果

 

 

记录在这里...以备以后使用.

你可能感兴趣的:(failed,ok,mysql启动脚本)