mysql/rc.mysql

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

michael@527 1 #!@l_prefix@/bin/openpkg rc
michael@527 2 ##
michael@527 3 ## rc.mysql -- Run-Commands
michael@527 4 ##
michael@527 5
michael@527 6 %config
michael@527 7 mysql_enable="$openpkg_rc_def"
michael@527 8 mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd
michael@527 9 mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf
michael@527 10 mysql_common_prolog="true"
michael@527 11 mysql_common_epilog="true"
michael@527 12 mysql_common_numfiles="10"
michael@527 13 mysql_common_minsize="1M"
michael@527 14 mysql_common_complevel="9"
michael@527 15 mysql_err_prolog="true"
michael@527 16 mysql_err_epilog="true"
michael@527 17 mysql_err_numfiles="10"
michael@527 18 mysql_err_minsize="1M"
michael@527 19 mysql_err_complevel="9"
michael@527 20
michael@527 21 %common
michael@527 22 mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid
michael@527 23 mysql_err_log=@l_prefix@/var/mysql/mysqld.err
michael@527 24 mysql_common_log=@l_prefix@/var/mysql/common.log
michael@527 25 mysql_flush_logs () {
michael@527 26 HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
michael@527 27 --defaults-extra-file=${mysql_pwd_file} \
michael@527 28 flush-logs
michael@527 29 }
michael@527 30
michael@527 31 %status -u @l_susr@ -o
michael@527 32 mysql_usable="unknown"
michael@527 33 mysql_active="no"
michael@527 34 HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
michael@527 35 --defaults-extra-file=${mysql_pwd_file} \
michael@527 36 ping >/dev/null 2>&1 && mysql_active="yes"
michael@527 37 if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then
michael@527 38 kill -0 `cat $mysql_pid_file` && mysql_active="unknown"
michael@527 39 fi
michael@527 40 echo "mysql_enable=\"$mysql_enable\""
michael@527 41 echo "mysql_usable=\"$mysql_usable\""
michael@527 42 echo "mysql_active=\"$mysql_active\""
michael@527 43
michael@527 44 %start -p 400 -u @l_susr@
michael@527 45 rcService mysql enable yes || exit 0
michael@527 46 rcService mysql active yes && exit 0
michael@527 47 cd @l_prefix@
michael@527 48 cmd="@l_prefix@/bin/mysqld_safe"
michael@527 49 cmd="$cmd --pid-file=$mysql_pid_file"
michael@527 50 cmd="$cmd --log-error=$mysql_err_log"
michael@527 51 su @l_rusr@ -c "$cmd </dev/null >/dev/null 2>&1 &" </dev/null >/dev/null 2>&1
michael@527 52
michael@527 53 %stop -p 600 -u @l_susr@
michael@527 54 rcService mysql enable yes || exit 0
michael@527 55 rcService mysql active no && exit 0
michael@527 56 mysql_flush_logs
michael@527 57 HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
michael@527 58 --defaults-extra-file=${mysql_pwd_file} \
michael@527 59 shutdown
michael@527 60
michael@527 61 %restart -p 400 -u @l_susr@
michael@527 62 rcService mysql enable yes || exit 0
michael@527 63 rcService mysql active no && exit 0
michael@527 64 rc mysql stop start
michael@527 65
michael@527 66 %daily -u @l_susr@
michael@527 67 rcService mysql enable yes || exit 0
michael@527 68 rcTmp -i
michael@527 69 hintfile=`rcTmp -f -n hint`
michael@527 70 shtool rotate -f \
michael@527 71 -n ${mysql_common_numfiles} -s ${mysql_common_minsize} -d \
michael@527 72 -z ${mysql_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
michael@527 73 -P "${mysql_common_prolog}" \
michael@527 74 -E "${mysql_common_epilog}; echo 1 >$hintfile" \
michael@527 75 ${mysql_common_log}
michael@527 76 shtool rotate -f \
michael@527 77 -n ${mysql_err_numfiles} -s ${mysql_err_minsize} -d \
michael@527 78 -z ${mysql_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
michael@527 79 -P "${mysql_err_prolog}" \
michael@527 80 -E "${mysql_err_epilog}; echo 1 >$hintfile" \
michael@527 81 ${mysql_err_log}
michael@527 82 if [ -s $hintfile ]; then
michael@527 83 mysql_flush_logs
michael@527 84 fi
michael@527 85 rcTmp -k
michael@527 86

mercurial