0

My daemon used to run under 10.04, but no longer starts automatically on 12.04. If I start it manually

/etc/init.d/sqlexecd start, it works.

Here is the output of 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

Here is the output of chkconfig -l sqlexecd

sqlexecd                  0:off  1:off  2:on   3:on   4:on   5:on   6:off

Here is the daemon. I am well aware it does not stop.

#! /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 $?

Here is the error in the log. Yet, this error does not happen when starting after boot manually.

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#

What else should I be configuring to make it autostart?

Thanks.

Edit:

This appears to be a service run order dependency problem, and I have since added this to my daemon including the -e after #!/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
#

None of these changes change the original error.

Here is networking's daemon as requested:

#!/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[a-z]*|/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[a-z]*|/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
octopusgrabbus
  • 175
  • 5
  • 21

1 Answers1

1
Network driver cannot bind a name to the port.

I'm not familiar with Informix but I suspect that it can be only started after the network service is up. Since you are using Red Hat style init script, there is no way to ensure that.

It is not enough if you just change the lsb headers. Change entire the sqlexecd script to the Debian style and try again.

quanta
  • 51,413
  • 19
  • 159
  • 217