Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: Script file: Foutmelding in update-rc.d  (gelezen 522 keer)

Offline dorus43

  • Lid
Script file: Foutmelding in update-rc.d
« Gepost op: 2015/12/28, 03:17:33 »
Ik heb onlangs al mijn (3) kaarten met smargo's op mijn excito b3 nas aangesloten. Deze nas heeft Debian
squeeze als operating system.

Oscam start ik nu nog steeds manueel via ssh, maar heb onlangs een script gevonden om deze automatisch te starten.
( http://linge-ma.ws/o...-linux-distros/ )

via ssh als root aangelogd heb ik :
het bestand /etc/init.d/oscam aangemaakt,
de rechten gewijzigd (chmod +x /etc/init.d/oscam).

bij het uitvoeren van "update-rc.d oscam defaults"

krijg ik echter de volgende fout melding:
root@b3:/etc/init.d# update-rc.d oscam defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'oscam' missing LSB tags and overrides
insserv: There is a loop between service minidlna and oscam if stopped
insserv:  loop involving service oscam at depth 2
insserv:  loop involving service minidlna at depth 1
insserv: Stopping oscam depends on minidlna and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header

Dit gaat  boven mijn kennis kan er iemand mij helpen?
 Hieronder de 2 minidlna en oscam script files

Alvast bedankt

Dorus

root@b3:/etc/init.d# cat oscam
#!/bin/sh
 
DAEMON=/usr/local/bin/oscam
PIDFILE=/var/run/oscam.pid
DAEMON_OPTS="-p 1024 -w 5 -r 2 -B ${PIDFILE}"
 
test -x ${DAEMON} || exit 0
 
. /lib/lsb/init-functions
 
case "$1" in
    start)
   log_daemon_msg "Starting OScam..."
   /sbin/start-stop-daemon --start --quiet --background  --exec ${DAEMON} -- ${DAEMON_OPTS}
   log_end_msg $?
    ;;
  stop)
   log_daemon_msg "Stopping OScam..."
   /sbin/start-stop-daemon --stop --exec ${DAEMON}
   log_end_msg $?
    ;;
  restart)
   $0 stop
   $0 start
    ;;
  force-reload)
   $0 stop
   /bin/kill -9 `pidof oscam`
   /usr/bin/killall -9 oscam
   $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/oscam {start|stop|restart|force-reload}"
    exit 1
    ;;
esacroot@b3:/etc/init.d#

esacroot@b3:/etc/init.d# cat minidlna
#!/bin/sh
#
# MiniDLNA initscript
#
# Based on the mediatomb debian package.
# Original authors: Tor Krill <tor@excito.com>
#                   Leonhard Wimmer <leo@mediatomb.cc>
#                   Andres Mejia <mcitadel@gmail.com>
#
# Modified by: BenoƮt Knecht <benoit.knecht@fsfe.org>
#
### BEGIN INIT INFO
# Provides:          minidlna
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop::    $network $local_fs $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start minidlna at boot time
# Description:       Manage the minidlna daemon, a DLNA/UPnP-AV media server.
### END INIT INFO

unset USER

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="DLNA/UPnP-AV media server"
NAME=minidlna
DAEMON=/usr/bin/minidlna
PIDDIR=/var/run/$NAME
PIDFILE=$PIDDIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
DEFAULT=/etc/default/$NAME

# Exit if the package is not installed
[ -x $DAEMON ] || exit 0

# Read configuration variable file if it is present
[ -r $DEFAULT ] && . $DEFAULT

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Do not start the daemon if NO_START is enabled in DEFAULT
if [ "$START_DAEMON" != "yes" ] && [ "$1" != "stop" ]; then
    log_warning_msg "$NAME: Not starting $DESC."
    log_warning_msg "$NAME: Disabled in $DEFAULT."
    exit 0
fi

# Set the default configuration file
if [ -z $CONFIGFILE ]; then
    CONFIGFILE=/etc/minidlna.conf
fi

# Set the default log file
if [ -z $LOGFILE ]; then
    LOGFILE=/var/log/minidlna.log
fi

# Run as `minidlna' if USER is not specified or is `root'
if [ -z $USER ]; then
    USER=minidlna
fi

# If no group is specified, use USER
if [ -z $GROUP ]; then
    GROUP=$USER
fi

DAEMON_ARGS="-f $CONFIGFILE -P $PIDFILE $DAEMON_OPTS"

#
# Function that starts the daemon/service
#
do_start()
{
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    touch $LOGFILE && chown $USER:$GROUP $LOGFILE || return 2
    if [ ! -d $PIDDIR ]; then
        mkdir $PIDDIR || return 2
    fi
    chown $USER:$GROUP $PIDDIR || return 2

    start-stop-daemon --start --quiet --pidfile $PIDFILE \
        --chuid $USER:$GROUP --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE \
        --chuid $USER:$GROUP --exec $DAEMON -- \
        $DAEMON_ARGS \
        || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -rf $PIDDIR
    return "$RETVAL"
}

case "$1" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
    do_start
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
  ;;
  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  status)
       status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  restart|force-reload)
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
        if [ "$1" = "force-reload" ]; then
            # Rescan the collection
            DAEMON_ARGS="$DAEMON_ARGS -R"
        fi
        do_start
        case "$?" in
            0) log_end_msg 0 ;;
            1) log_end_msg 1 ;; # Old process is still running
            *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
      *)
          # Failed to stop
        log_end_msg 1
        ;;
    esac
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
    exit 3
    ;;
esac

moderator edit:  code tags geplaatst en topic verplaatst naar "Andere Distro's".
« Laatst bewerkt op: 2015/12/28, 10:44:15 door Ron »

Offline dorus43

  • Lid
Re: Script file: Foutmelding in update-rc.d
« Reactie #1 Gepost op: 2015/12/28, 12:05:29 »
Opgelost, Ik heb op

  http://linuxsat-supp...ead.php?t=71603   

een beter script file gevonden en deze gaf geen foutmelding

 de nieuw  gebruikte oscam script is:

 

# OSCam Start/Stop Script
#
### BEGIN INIT INFO
# Provides:          OSCam
# Required-Start:   
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable OSCam service.
### END INIT INFO
#
# USER SETUP ###############################################
# ----------------------------------------------------------
# Path to the camd binaries - without trailing slash!
# Example: camd_path='/var/emu'
camd_path='/usr/local/bin'
# ----------------------------------------------------------
# Path to the camd configuration files - without trailing slash!
# Example: camd_c_path='/var/keys'
camd_c_path='/usr/local/etc'
# ----------------------------------------------------------
# CAMD PROCESS NAME
camd_ps_oscam='oscam'
# ----------------------------------------------------------
# Max time in seconds before sending killall SIGKILL to CAMD - default 5
camd_max_killtime=5
# ----------------------------------------------------------
# CAMD logfile
camd_logfile='/var/log/oscam/oscam.log'
#camd_logfile='/dev/null' # <-- logging off
# ----------------------------------------------------------
# CAMD START COMMAND
camd_start_oscam="$camd_path/$camd_ps_oscam -c $camd_c_path"
# END USER SETUP ###########################################

# PRIVATE VARs *********************************************
hr='------------------------------------------------------------'

# FUNCTIONS ************************************************
fStop() {
    echo "$hr" >> $camd_logfile
    echo `date`": Stopping $1..." >> $camd_logfile
    if ! pidof $1 > /dev/null; then
        echo `date`": $1 is not running" >> $camd_logfile
    else
        echo `date`": Send kill SIGTERM to $1" >> $camd_logfile
        kill -15 $(pidof $1) >> $camd_logfile 2>&1
        sleep 1
        if pidof $1 > /dev/null; then
            i=$camd_max_killtime
            while expr $i != 0 > /dev/null; do
                if pidof $1 > /dev/null; then
                    echo `date`": Waiting max $i seconds before sending kill SIGKILL to $1..." >> $camd_logfile
                else
                    echo `date`": $1 successfully killed" >> $camd_logfile
                    break
                fi
                i=`expr $i - 1`
                sleep 1
            done
        else
            echo `date`": $1 successfully killed" >> $camd_logfile
        fi
        if pidof $1 > /dev/null; then
            echo `date`": Sending killall SIGKILL to $1!" >> $camd_logfile
            killall -9 $1 >> $camd_logfile 2>&1
        fi
    fi
}

fStart() {
    if pidof $1 > /dev/null; then
        fStop $1
    fi
    echo "$hr" >> $camd_logfile
    echo `date`": Starting $1..." >> $camd_logfile
    camd_start=$(eval echo \${"camd_start_$1"})
    echo `date`": $camd_start" >> $camd_logfile
    $camd_start > /dev/null 2>&1 &
    sleep 1
    if pidof $1 > /dev/null; then
        echo `date`": $1 successfully started" >> $camd_logfile
    else
        echo `date`": Could not start $1!" >> $camd_logfile
    fi
}

# BY PARAMETER *********************************************
case "$1" in
    'stop')
        fStop "$camd_ps_oscam"
    ;;
    'start'|'restart'|'reload')
        fStart "$camd_ps_oscam"
    ;;
    *)
        msg='Usage: /etc/init.d/oscam {start|stop|restart|force-reload}'
        echo "$msg"
        echo "$hr" >> $camd_logfile
        echo `date`": $msg" >> $camd_logfile
        exit 1
    ;;
esac
exit 0
« Laatst bewerkt op: 2015/12/29, 06:48:38 door dorus43 »