Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 18th December 2011, 22:58
talkingnews talkingnews is offline
Member
 
Join Date: Jan 2011
Posts: 65
Thanks: 15
Thanked 5 Times in 5 Posts
 
Default init.d script worked OK on Ubuntu 10.10 but not on 11.10 despite LBS header correct

On Ubuntu 11.10, if I run /usr/bin/cserver -c /etc/cserver.conf & the service runs fine.

But if I run service cserver start or /etc/init.d/cserver start as I did on 10.10, it won't. It just says "starting cServer", and that's the last I hear of it.

Here's the script:

Code:
#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          cserver
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $network $time
# Should-Stop:       $network $time
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Start and stop the cserver server daemon
# Description:       Controls the cserver server daemon
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}

CSERVERDIR=/usr/bin
PROG=./cserver
OPTIONS=" -c /etc/cserver.conf > /dev/null 2>&1 &"

start() {
          echo -n "Starting cServer "
          cd $CSERVERDIR
      daemon $PROG $OPTIONS
          RETVAL=$?
          echo
          return $RETVAL
}
stop() {
          CSERVERPID=$(pidof cserver)
          if [ $CSERVERPID ] ; then
        echo -n "Stopping cServer "
            kill $(pidof cserver)
            RETVAL=$?
          else
            echo "cServer not running"
            RETVAL=1
          fi
          echo
          return $RETVAL
}
status() {
          CSERVERPID=$(pidof cserver)
          if [ $CSERVERPID ] ; then
            echo -n "cServer is running"
            RETVAL=0
          else
            echo -n "cServer is stopped"
            RETVAL=1
          fi
          echo
          return $RETVAL
}

# See how we were called.
RETVAL=0

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  status)
        status
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|status}"
        exit 1
esac

exit $?
Although I never had to do this on the original server, and sysv-rc-conf showed it present in the list and starting at the right levels, I manually tried doing the update-rc.d and it complained about an invalid lsb header, which led me to this question and guide. So I changed the header as above, and here's what it looked like before:

Code:
#!/bin/bash
#
#
# chkconfig: 345 99 99
#
# description: cserver init
# processname: cserver

# Source function library.
# . /etc/rc.d/init.d/functions
Now, there's that line about "Source function library", but that directory doesn't even exist and the line is commented out anyway.

I've checked the permissions and symlinks etc on the old server, and everything seems identical.

A little bit dazed and confused now - perhaps a fresh and more knowledgaeble pair of eyes can spot something here? Thanks.
Reply With Quote
Sponsored Links
Reply

Bookmarks

Tags
init.d, service, ubuntu 11.10

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camfrogserver 5.0 w/ Ubuntu 10.10 Maverick Meerkat using alien JamesY Installation/Configuration 1 13th August 2012 03:51
High quality video security with Ubuntu desktop 10.10, Zoneminder 1.24.x and webcam. letsharehowto HOWTO-Related Questions 7 18th December 2011 13:01
Cannot login to phpmyadmin penkku HOWTO-Related Questions 1 24th February 2011 09:26
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
Problem on restart bind9 satimis Server Operation 6 30th October 2007 02:01


All times are GMT +2. The time now is 22:30.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.