我的守护进程常常在10.04下运行,但不再在12.04自动启动。 如果我手动启动它
/etc/init.d/sqlexecd start,它的工作原理。
这里是uname的输出-a
Linux steamboy 3.2.0-30-generic-pae #48-Ubuntu SMP Fri Aug 24 17:14:09 UTC 2012 i686 i686 i386 GNU/Linux
这里是chkconfig -l sqlexecd的输出
sqlexecd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
这是守护进程。 我清楚地意识到,它并没有停止。
#! /bin/bash # # informix - Script to start/stop the Informix database servitron. # # Revision History: # ewilde 2004Mar23 Initial coding. # # chkconfig: 2345 12 78 # description: Informix SQL database server. # processname: sqlexecd # config: /usr/share/informix/etc/sqlhosts # pidfile: /var/run/informix/sqlexecd.pid # Source function library. #/etc/init.d/functions # LSB compliance (kinda) if [ -f /lib/lsb/init-functions ]; then . /lib/lsb/init-functions; else log_begin_msg() { echo "$@"; }; log_success_msg() { echo "$@"; }; log_warning_msg() { echo "$@"; }; fi; # Source networking configuration. #. /etc/network # Information about what and where we're running. prog="Informix" export INFORMIXDIR="/usr/share/informix" lockfile="/var/lock/sqlexecd" logfile="/var/log/sqlexecd.log" process="sqlexecd" service="steamboy" owner="informix" # Start up Informix. start() { # Set up the logfile. touch ${logfile} chown ${owner}.${owner} ${logfile} chmod 0664 ${logfile} # Start the servitron. ${INFORMIXDIR}/lib/${process} ${service} -l ${logfile} >/dev/null 2>&1 # How'd that go? ret=$? if [ $ret -eq 0 ]; then echo $"Starting sqlexecd: " /bin/true else echo $"Starting sqlexecd: " /bin/false fi # Locking, if necessary. [ $ret -eq 0 ] && touch ${lockfile} return $ret } # Stop Informix. stop() { # If there's a lock file, try to find the PID. if [ -f ${lockfile} ]; then SQLPID=`ps -eo pid,args | grep ${INFORMIXDIR} | grep ${process} | sed -n 's/^ *\([0-9]*\).*/\1/p'` if [ x"$SQLPID" != x ]; then # Kill the PID. kill -9 $SQLPID ret=$? # See how it went. if [ $ret -eq 0 ]; then action $"Stopping $prog: " /bin/true else action $"Stopping $prog: " /bin/false fi # Clean up the lock file. [ $ret -eq 0 ] && rm -f ${lockfile} return $ret fi fi # Not running. return 0 } # Restart Informix. restart() { stop start } # Conditional restart of Informix. condrestart() { [ -e ${lockfile} ] && restart || : } # See how we were called. case "${1}" in start) start ;; stop) stop ;; status) ps -ef | grep sqlexecd #status ${process} ;; restart) restart ;; condrestart) condrestart ;; *) echo $"Usage: $0 {start|stop|status|condrestart|restart}" exit 1 esac exit $?
这是日志中的错误。 但是,手动引导后启动时不会发生此错误。
2012-09-08 12:28:19.475867 Starting Daemon INFORMIX-SQL Version 7.25.UC6R1 Command Line = /usr/share/informix/lib/sqlexecd steamboy -l /var/log/sqlexecd.log INFORMIXDIR = /usr/share/informix dbservername = steamboy nettype = sesoctcp hostname = steamboy servicename = informix options = # Well-known Informix TCP port 2012-09-08 12:28:19.478349 daemon err = -25572: Network driver cannot bind a name to the port. System error = 99. root@steamboy:/var/log#
还有什么我应该configuration,使其自动启动?
谢谢。
这似乎是一个服务运行顺序依赖的问题,我已经把它添加到我的守护进程,包括-e后的#!/ bin / bash
#!/bin/bash -e ### BEGIN INIT INFO # Provides: sqlexecd # Required-Start: $network $syslog # Required-Stop: $network $syslog # Default-Start: 3 5 # Default-Stop: 1 # Short-Description: Simple script to run Informix SE daemon. ### END INIT INFO #
这些更改都不会改变原始错误。
这是networking守护进程的要求:
#!/bin/sh -e ### BEGIN INIT INFO # Provides: networking # Required-Start: # Required-Stop: $local_fs # Should-Start: ifupdown # Should-Stop: ifupdown # Default-Start: # Default-Stop: 0 6 # Short-Description: Raise network interfaces. ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" [ -x /sbin/ifup ] || exit 0 . /lib/lsb/init-functions # helper function to set the usplash timeout. https://launchpad.net/bugs/21617 usplash_timeout () { TIMEOUT=$1 if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TIMEOUT $TIMEOUT" || true fi } process_options() { [ -e /etc/network/options ] || return 0 log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase." } check_network_file_systems() { [ -e /proc/mounts ] || return 0 if [ -e /etc/iscsi/iscsi.initramfs ]; then log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted." exit 0 fi exec 9<&0 < /proc/mounts while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd[az]*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network devices still mounted." exit 0 ;; esac case $FSTYPE in nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) log_warning_msg "not deconfiguring network interfaces: network file systems still mounted." exit 0 ;; esac done exec 0<&9 9<&- } check_network_swap() { [ -e /proc/swaps ] || return 0 exec 9<&0 < /proc/swaps while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd[az]*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network swap still mounted." exit 0 ;; esac done exec 0<&9 9<&- } case "$1" in start) /lib/init/upstart-job networking start ;; stop) check_network_file_systems check_network_swap # Anything that manages network interfaces *MUST* wait for this event initctl emit deconfiguring-networking log_action_begin_msg "Deconfiguring network interfaces" if [ "$VERBOSE" != no ]; then if ifdown -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi else if ifdown -a --exclude=lo >/dev/null 2>/dev/null; then log_action_end_msg $? else log_action_end_msg $? fi fi ;; force-reload|restart) process_options log_warning_msg "Running $0 $1 is deprecated because it may not enable again some interfaces" log_action_begin_msg "Reconfiguring network interfaces" ifdown -a --exclude=lo || true if ifup -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi ;; *) echo "Usage: /etc/init.d/networking {start|stop}" exit 1 ;; esac exit 0
Network driver cannot bind a name to the port.
我不熟悉Informix,但是我怀疑它只能在networking服务启动后才能启动。 由于您使用的是红帽风格的初始化脚本,因此无法确保。
如果你只是改变LSB标题是不够的。 将整个sqlexecd脚本更改为Debian样式,然后重试。