OSCam/de/ShellCommands: Unterschied zwischen den Versionen

Aus Streamboard Wiki
Zur Navigation springen Zur Suche springen
 
(7 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 8: Zeile 8:
==== Startparameter abfragen ====
==== Startparameter abfragen ====
Mit welchen Parametern lässt sich OSCam starten?
Mit welchen Parametern lässt sich OSCam starten?
<PATH_TO_OSCAM>/oscam -h
<syntaxhighlight lang="bash">
Beispiel:
<PATH_TO_OSCAM>/oscam -h
  ___  ____  ___
 
  / _ \/ ___| / __|__ _ _ __ ___
  ___  ____  ___
| | | \___ \| |  / _` | '_ ` _ \
/ _ \/ ___| / __|__ _ _ __ ___
| |_| |___) | |_| (_| | | | | | |
| | | \___ \| |  / _` | '_ ` _ \
  \___/|____/ \___\__,_|_| |_| |_|
| |_| |___) | |_| (_| | | | | | |
\___/|____/ \___\__,_|_| |_| |_|
 
OSCam cardserver v1.00-unstable_svn, build #4611 (i686-pc-linux) - (w) 2009-2011 Streamboard SVN
OSCam cardserver v1.20-unstable_svn, build r9898 (x86_64-linux-gnu)
        see http://streamboard.gmc.to/oscam/ for more details
Copyright (C) 2009-2013 OSCam developers.
        based on Streamboard mp-cardserver v0.9d - (w) 2004-2007 by dukat
This program is distributed under GPLv3.
        This program is distributed under GPL.
OSCam is based on Streamboard mp-cardserver v0.9d written by dukat
        inbuilt modules: webinterface irdeto-guessing anticascading debug doublecheck loghistory smartreader pcsc gbox
Visit http://www.streamboard.tv/oscam/ for more details.
        inbuilt protocols: monitor camd35-udp newcamd cccam serial
 
        inbuilt cardreader: nagra irdeto tongfang
ConfigDir  : /usr/local/etc
 
  oscam [-b] [-c config-dir] [-d] [-h]
  Usage: oscam [parameters]
   
 
        -b        : start in background
  Directories:
        -c <dir>   : read configuration from <dir>
-c, --config-dir <dir> | Read configuration files from <dir>.
                      default = /var/keys
                        . Default: /usr/local/etc
        -t <dir>   : tmp dir <dir>
-t, --temp-dir <dir>   | Set temporary directory to <dir>.
                      default = /tmp/.oscam
                        . Default: /tmp/.oscam
        -d <level> : debug level mask
 
                        0 = no debugging (default)
Startup:
                        1 = detailed error messages
-b, --daemon            | Start in the background as daemon.
                        2 = ATR parsing info, ECM, EMM and CW dumps
-B, --pidfile <pidfile> | Create pidfile when starting.
                        4 = traffic from/to the reader
-r, --restart <level>  | Set restart level:
                        8 = traffic from/to the clients
                        .  0 - Restart disabled (exit on restart request).
                      16 = traffic to the reader-device on IFD layer
                        .  1 - WebIf restart is active (default).
                      32 = traffic to the reader-device on I/O layer
                        .  2 - Like 1, but also restart on segfaults.
                      64 = EMM logging
-w, --wait <secs>      | Set how much seconds to wait at startup for the
                      128 = DVBAPI logging
                        . system clock to be set correctly. Default: 60
                      255 = debug all
 
        -r        : restart level
Logging:
                        0 = disabled, restart request sets exit status 99
-I, --syslog-ident <ident> | Set syslog ident. Default: oscam
                        1 = restart activated, web interface can restart oscam (default)
-S, --show-sensitive    | Do not filter sensitive info (card serials, boxids)
                        2 = like 1, but also restart on SEGFAULTS
                        . from the logs.
        -h         : show this help
-d, --debug <level>     | Set debug level mask used for logging:
                        .    0 - No extra debugging (default).
                        .    1 - Detailed error messages.
                        .    2 - ATR parsing info, ECM, EMM and CW dumps.
                        .    4 - Traffic from/to the reader.
                        .    8 - Traffic from/to the clients.
                        .    16 - Traffic to the reader-device on IFD layer.
                        .    32 - Traffic to the reader-device on I/O layer.
                        .    64 - EMM logging.
                        .  128 - DVBAPI logging.
                        .  256 - Loadbalancer logging.
                        .  512 - CACHEEX logging.
                        .  1024 - Client ECM logging.
                        .  2048 - CSP logging.
                        .  4096 - CWC logging.
                        . 65535 - Debug all.
 
Settings:
-p, --pending-ecm <num> | Set the maximum number of pending ECM packets.
                        . Default: 32 Max: 4096
-u, --utf8              | Enable WebIf support for UTF-8 charset.
 
Debug parameters:
-a, --crash-dump        | Write oscam.crash file on segfault. This option
                        . needs GDB to be installed and OSCam executable to
                        . contain the debug information (run oscam-XXXX.debug)
-s, --capture-segfaults | Capture segmentation faults.
-g, --gcollect <mode>  | Garbage collector debug mode:
                        .  1 - Immediate free.
                        .  2 - Check for double frees.
 
Information:
-h, --help              | Show command line help text.
-V, --build-info        | Show OSCam binary configuration and version.
</syntaxhighlight>


==== Starten- und Beenden-Beispiel ====
==== Starten- und Beenden-Beispiel ====
#!/bin/sh
<syntaxhighlight lang="bash">
# 2011/01/26 - OSCam Start/Stop-Example
#!/bin/sh
#
# 2011/01/26 - OSCam Start/Stop-Example
# Examples *************************************************
#
# <PATH_TO_SCRIPT>/<SCRIPT_NAME> <PARAMETER>
# Examples *************************************************
# /var/emu/oscam.sh stop
# <PATH_TO_SCRIPT>/<SCRIPT_NAME> <PARAMETER>
# /var/emu/oscam.sh start
# /var/emu/oscam.sh stop
# /var/emu/oscam.sh reload (same as "start" or "restart")
# /var/emu/oscam.sh start
#
# /var/emu/oscam.sh reload (same as "start" or "restart")
# USER SETUP ###############################################
#
# ----------------------------------------------------------
# USER SETUP ###############################################
# Path to the camd binaries - without trailing slash!
# ----------------------------------------------------------
# Example: camd_path='/var/emu'
# Path to the camd binaries - without trailing slash!
camd_path='/var/emu'
# Example: camd_path='/var/emu'
# ----------------------------------------------------------
camd_path='/var/emu'
# Path to the camd configuration files - without trailing slash!
# ----------------------------------------------------------
# Example: camd_c_path='/var/keys'
# Path to the camd configuration files - without trailing slash!
camd_c_path='/var/keys'
# Example: camd_c_path='/var/keys'
# ----------------------------------------------------------
camd_c_path='/var/keys'
# CAMD PROCESS NAME
# ----------------------------------------------------------
camd_ps_oscam='oscam'
# CAMD PROCESS NAME
# ----------------------------------------------------------
camd_ps_oscam='oscam'
# Max time in seconds before sending killall SIGKILL to CAMD - default 5
# ----------------------------------------------------------
camd_max_killtime=5
# Max time in seconds before sending killall SIGKILL to CAMD - default 5
# ----------------------------------------------------------
camd_max_killtime=5
# CAMD logfile
# ----------------------------------------------------------
camd_logfile='/tmp/camd.log'
# CAMD logfile
#camd_logfile='/dev/null' # <-- logging off
camd_logfile='/tmp/camd.log'
# ----------------------------------------------------------
#camd_logfile='/dev/null' # <-- logging off
# CAMD START COMMAND
# ----------------------------------------------------------
camd_start_oscam="$camd_path/$camd_ps_oscam -c $camd_c_path"
# CAMD START COMMAND
# END USER SETUP ###########################################
camd_start_oscam="$camd_path/$camd_ps_oscam -c $camd_c_path"
# END USER SETUP ###########################################
# PRIVATE VARs *********************************************
 
hr='------------------------------------------------------------'
# PRIVATE VARs *********************************************
hr='------------------------------------------------------------'
# FUNCTIONS ************************************************
 
fStop() {
# FUNCTIONS ************************************************
    echo "$hr" >> $camd_logfile
fStop() {
    echo `date`": Stopping $1..." >> $camd_logfile
    echo "$hr" >> $camd_logfile
    if ! pidof $1 > /dev/null; then
    echo `date`": Stopping $1..." >> $camd_logfile
        echo `date`": $1 is not running" >> $camd_logfile
    if ! pidof $1 > /dev/null; then
    else
        echo `date`": $1 is not running" >> $camd_logfile
        echo `date`": Send kill SIGTERM to $1" >> $camd_logfile
    else
        kill -15 $(pidof $1) >> $camd_logfile 2>&1
        echo `date`": Send kill SIGTERM to $1" >> $camd_logfile
        sleep 1
        kill -15 $(pidof $1) >> $camd_logfile 2>&1
        if pidof $1 > /dev/null; then
        sleep 1
            i=$camd_max_killtime
        if pidof $1 > /dev/null; then
            while expr $i != 0 > /dev/null; do
            i=$camd_max_killtime
                if pidof $1 > /dev/null; then
            while expr $i != 0 > /dev/null; do
                    echo `date`": Waiting max $i seconds before sending kill SIGKILL to $1..." >> $camd_logfile
                if pidof $1 > /dev/null; then
                else
                    echo `date`": Waiting max $i seconds before sending kill SIGKILL to $1..." >> $camd_logfile
                    echo `date`": $1 successfully killed" >> $camd_logfile
                else
                    break
                    echo `date`": $1 successfully killed" >> $camd_logfile
                fi
                    break
                i=`expr $i - 1`
                fi
                sleep 1
                i=`expr $i - 1`
            done
                sleep 1
        else
            done
            echo `date`": $1 successfully killed" >> $camd_logfile
        else
        fi
            echo `date`": $1 successfully killed" >> $camd_logfile
        if pidof $1 > /dev/null; then
        fi
            echo `date`": Sending killall SIGKILL to $1!" >> $camd_logfile
        if pidof $1 > /dev/null; then
            killall -9 $1 >> $camd_logfile 2>&1
            echo `date`": Sending killall SIGKILL to $1!" >> $camd_logfile
        fi
            killall -9 $1 >> $camd_logfile 2>&1
    fi
        fi
}
    fi
}
fStart() {
 
    if pidof $1 > /dev/null; then
fStart() {
        fStop $1
    if pidof $1 > /dev/null; then
    fi
        fStop $1
    echo "$hr" >> $camd_logfile
    fi
    echo `date`": Starting $1..." >> $camd_logfile
    echo "$hr" >> $camd_logfile
    camd_start=$(eval echo \${"camd_start_$1"})
    echo `date`": Starting $1..." >> $camd_logfile
    echo `date`": $camd_start" >> $camd_logfile
    camd_start=$(eval echo \${"camd_start_$1"})
    $camd_start > /dev/null 2>&1 &
    echo `date`": $camd_start" >> $camd_logfile
    sleep 1
    $camd_start > /dev/null 2>&1 &
    if pidof $1 > /dev/null; then
    sleep 1
        echo `date`": $1 successfully started" >> $camd_logfile
    if pidof $1 > /dev/null; then
    else
        echo `date`": $1 successfully started" >> $camd_logfile
        echo `date`": Could not start $1!" >> $camd_logfile
    else
    fi
        echo `date`": Could not start $1!" >> $camd_logfile
}
    fi
}
# BY PARAMETER *********************************************
 
case "$1" in
# BY PARAMETER *********************************************
    'stop')
case "$1" in
        fStop "$camd_ps_oscam"
    'stop')
    ;;
        fStop "$camd_ps_oscam"
    'start'|'restart'|'reload')
    ;;
        fStart "$camd_ps_oscam"
    'start'|'restart'|'reload')
    ;;
        fStart "$camd_ps_oscam"
    *)
    ;;
        msg='UNKNWON OR MISSING PARAMETER!'
    *)
        echo "$msg"
        msg='UNKNWON OR MISSING PARAMETER!'
        echo "$hr" >> $camd_logfile
        echo "$msg"
        echo `date`": $msg" >> $camd_logfile
        echo "$hr" >> $camd_logfile
        exit 1
        echo `date`": $msg" >> $camd_logfile
    ;;
        exit 1
esac
    ;;
exit 0
esac
exit 0
</syntaxhighlight>


=== Reloads ===
=== Reloads ===
Zeile 163: Zeile 199:


=== Sonstiges ===
=== Sonstiges ===
Anzahl der Reader ermitteln:
Anzahl der Reader ermitteln (ab #4633 '''veraltet'''!):
r=0
<syntaxhighlight lang="bash">
if [ -d "/tmp/.oscam" ]; then
r=0
    r=$(ls -l /tmp/.oscam/reader* | wc -l)
if [ -d "/tmp/.oscam" ]; then
fi
    r=$(ls -l /tmp/.oscam/reader* | wc -l)
echo $r
fi
echo $r
</syntaxhighlight>




{{OSCamTranslatedLinks}}
{{OSCamTranslatedLinks}}

Aktuelle Version vom 21. Oktober 2014, 13:47 Uhr

OSCam Übersicht OSCam Home OSCam Accueil OSCam Home

OSCam Shell-Befehle

Nachfolgende Befehle helfen nicht nur den Image-Erstellern. Dem einen oder anderen, der "eigene" Skripte benötigt/einsetzt, hilft es sicherlich auch weiter.

OSCam starten und beenden

Startparameter abfragen

Mit welchen Parametern lässt sich OSCam starten? <syntaxhighlight lang="bash"> <PATH_TO_OSCAM>/oscam -h

 ___  ____   ___
/ _ \/ ___| / __|__ _ _ __ ___

| | | \___ \| | / _` | '_ ` _ \ | |_| |___) | |_| (_| | | | | | |

\___/|____/ \___\__,_|_| |_| |_|

OSCam cardserver v1.20-unstable_svn, build r9898 (x86_64-linux-gnu) Copyright (C) 2009-2013 OSCam developers. This program is distributed under GPLv3. OSCam is based on Streamboard mp-cardserver v0.9d written by dukat Visit http://www.streamboard.tv/oscam/ for more details.

ConfigDir  : /usr/local/etc
Usage: oscam [parameters]
Directories:
-c, --config-dir <dir>  | Read configuration files from <dir>.
                        . Default: /usr/local/etc
-t, --temp-dir <dir>    | Set temporary directory to <dir>.
                        . Default: /tmp/.oscam
Startup:
-b, --daemon            | Start in the background as daemon.
-B, --pidfile <pidfile> | Create pidfile when starting.
-r, --restart <level>   | Set restart level:
                        .   0 - Restart disabled (exit on restart request).
                        .   1 - WebIf restart is active (default).
                        .   2 - Like 1, but also restart on segfaults.
-w, --wait <secs>       | Set how much seconds to wait at startup for the
                        . system clock to be set correctly. Default: 60
Logging:
-I, --syslog-ident <ident> | Set syslog ident. Default: oscam
-S, --show-sensitive    | Do not filter sensitive info (card serials, boxids)
                        . from the logs.
-d, --debug <level>     | Set debug level mask used for logging:
                        .     0 - No extra debugging (default).
                        .     1 - Detailed error messages.
                        .     2 - ATR parsing info, ECM, EMM and CW dumps.
                        .     4 - Traffic from/to the reader.
                        .     8 - Traffic from/to the clients.
                        .    16 - Traffic to the reader-device on IFD layer.
                        .    32 - Traffic to the reader-device on I/O layer.
                        .    64 - EMM logging.
                        .   128 - DVBAPI logging.
                        .   256 - Loadbalancer logging.
                        .   512 - CACHEEX logging.
                        .  1024 - Client ECM logging.
                        .  2048 - CSP logging.
                        .  4096 - CWC logging.
                        . 65535 - Debug all.
Settings:
-p, --pending-ecm <num> | Set the maximum number of pending ECM packets.
                        . Default: 32 Max: 4096
-u, --utf8              | Enable WebIf support for UTF-8 charset.
Debug parameters:
-a, --crash-dump        | Write oscam.crash file on segfault. This option
                        . needs GDB to be installed and OSCam executable to
                        . contain the debug information (run oscam-XXXX.debug)
-s, --capture-segfaults | Capture segmentation faults.
-g, --gcollect <mode>   | Garbage collector debug mode:
                        .   1 - Immediate free.
                        .   2 - Check for double frees.
Information:
-h, --help              | Show command line help text.
-V, --build-info        | Show OSCam binary configuration and version.

</syntaxhighlight>

Starten- und Beenden-Beispiel

<syntaxhighlight lang="bash">

  1. !/bin/sh
  2. 2011/01/26 - OSCam Start/Stop-Example
  3. Examples *************************************************
  4. <PATH_TO_SCRIPT>/<SCRIPT_NAME> <PARAMETER>
  5. /var/emu/oscam.sh stop
  6. /var/emu/oscam.sh start
  7. /var/emu/oscam.sh reload (same as "start" or "restart")
  8. USER SETUP ###############################################
  9. ----------------------------------------------------------
  10. Path to the camd binaries - without trailing slash!
  11. Example: camd_path='/var/emu'

camd_path='/var/emu'

  1. ----------------------------------------------------------
  2. Path to the camd configuration files - without trailing slash!
  3. Example: camd_c_path='/var/keys'

camd_c_path='/var/keys'

  1. ----------------------------------------------------------
  2. CAMD PROCESS NAME

camd_ps_oscam='oscam'

  1. ----------------------------------------------------------
  2. Max time in seconds before sending killall SIGKILL to CAMD - default 5

camd_max_killtime=5

  1. ----------------------------------------------------------
  2. CAMD logfile

camd_logfile='/tmp/camd.log'

  1. camd_logfile='/dev/null' # <-- logging off
  2. ----------------------------------------------------------
  3. CAMD START COMMAND

camd_start_oscam="$camd_path/$camd_ps_oscam -c $camd_c_path"

  1. END USER SETUP ###########################################
  1. PRIVATE VARs *********************************************

hr='------------------------------------------------------------'

  1. 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

}

  1. BY PARAMETER *********************************************

case "$1" in

   'stop')
       fStop "$camd_ps_oscam"
   ;;
   'start'|'restart'|'reload')
       fStart "$camd_ps_oscam"
   ;;
   *)
       msg='UNKNWON OR MISSING PARAMETER!'
       echo "$msg"
       echo "$hr" >> $camd_logfile
       echo `date`": $msg" >> $camd_logfile
       exit 1
   ;;

esac exit 0 </syntaxhighlight>

Reloads

<syntaxhighlight lang="bash">

  1. Benutzer-Datenbank neuladen:

kill -1 `pidof oscam`

  1. Karten-Informationen neuladen:

killall -SIGUSR2 oscam </syntaxhighlight>

Sonstiges

Anzahl der Reader ermitteln (ab #4633 veraltet!): <syntaxhighlight lang="bash"> r=0 if [ -d "/tmp/.oscam" ]; then

   r=$(ls -l /tmp/.oscam/reader* | wc -l)

fi echo $r </syntaxhighlight>


Diese Seite in anderen Sprachen - This page in other languages - Cette page dans d'autres langues - Queste pagine in altre Lingue

[[OSCam/de/{{#titleparts:OSCam/de/ShellCommands|3|3}}|Deutsch]] [[OSCam/en/{{#titleparts:OSCam/de/ShellCommands|3|3}}|English]] [[OSCam/fr/{{#titleparts:OSCam/de/ShellCommands|3|3}}|Français]] [[OSCam/it/{{#titleparts:OSCam/de/ShellCommands|3|3}}|Italiano]]