OSCam/en/ShellCommands: Unterschied zwischen den Versionen

Aus Streamboard Wiki
Zur Navigation springen Zur Suche springen
(Translated to English.)
Zeile 1: Zeile 1:
 
[[Kategorie:OSCam]]
 
[[Kategorie:OSCam]]
 
{{OSCamHomeLinks}}
 
{{OSCamHomeLinks}}
 
[[Datei:WarningS.png|text-bottom]] '''Attention:''' The content of the english pages are partially still in german. Please register here to help us completing and translating the articles.
 
  
 
== OSCam Shell commands ==
 
== OSCam Shell commands ==
Nachfolgende Befehle helfen nicht nur den Image-Erstellern. Dem einen oder anderen, der "eigene" Skripte benötigt/einsetzt, hilft es sicherlich auch weiter.
+
This information is not only for image creators. They can also be useful for script writers, and other people.
  
=== OSCam starten und beenden ===
+
=== Starting and stopping OSCam ===
==== Startparameter abfragen ====
+
==== Command-line Parameters ====
Mit welchen Parametern lässt sich OSCam starten?
+
To find out what are the supported command-line parameters, invoke '''oscam''' with the <tt>-h</tt> parameter:
 
  <PATH_TO_OSCAM>/oscam -h
 
  <PATH_TO_OSCAM>/oscam -h
Beispiel:
+
 
 +
Example output:
 
   ___  ____  ___
 
   ___  ____  ___
 
   / _ \/ ___| / __|__ _ _ __ ___
 
   / _ \/ ___| / __|__ _ _ __ ___
Zeile 51: Zeile 50:
 
         -h        : show this help
 
         -h        : show this help
  
==== Starten- und Beenden-Beispiel ====
+
==== Example script for start/stop ====
 
  #!/bin/sh
 
  #!/bin/sh
 
  # 2011/01/26 - OSCam Start/Stop-Example
 
  # 2011/01/26 - OSCam Start/Stop-Example
Zeile 155: Zeile 154:
 
  exit 0
 
  exit 0
  
=== Reloads ===
+
=== OSCam Reloaded ===
Benutzer-Datenbank neuladen:
+
Reloading the user database:
 
  kill -1 `pidof oscam`
 
  kill -1 `pidof oscam`
Karten-Informationen neuladen:
+
 
 +
Reloading the card information:
 
  killall -SIGUSR2 oscam
 
  killall -SIGUSR2 oscam
  
=== Sonstiges ===
+
=== Miscellaneous ===
Anzahl der Reader ermitteln:
+
Script to determine number of readers:
 
  r=0
 
  r=0
 
  if [ -d "/tmp/.oscam" ]; then
 
  if [ -d "/tmp/.oscam" ]; then

Version vom 17. März 2011, 11:57 Uhr

LanguageDE S.png OSCam Übersicht LanguageEN S.png OSCam Home LanguageFR S.png OSCam Accueil LanguageIT S.png OSCam Home

OSCam Shell commands

This information is not only for image creators. They can also be useful for script writers, and other people.

Starting and stopping OSCam

Command-line Parameters

To find out what are the supported command-line parameters, invoke oscam with the -h parameter:

<PATH_TO_OSCAM>/oscam -h

Example output:

  ___  ____   ___
 / _ \/ ___| / __|__ _ _ __ ___
| | | \___ \| |  / _` | '_ ` _ \
| |_| |___) | |_| (_| | | | | | |
 \___/|____/ \___\__,_|_| |_| |_|


OSCam cardserver v1.00-unstable_svn, build #4611 (i686-pc-linux) - (w) 2009-2011 Streamboard SVN
        see http://streamboard.gmc.to/oscam/ for more details
        based on Streamboard mp-cardserver v0.9d - (w) 2004-2007 by dukat
        This program is distributed under GPL.
        inbuilt modules: webinterface irdeto-guessing anticascading debug doublecheck loghistory smartreader pcsc gbox
        inbuilt protocols: monitor camd35-udp newcamd cccam serial
        inbuilt cardreader: nagra irdeto tongfang

oscam [-b] [-c config-dir] [-d] [-h]

        -b         : start in background
        -c <dir>   : read configuration from <dir>
                     default = /var/keys
        -t <dir>   : tmp dir <dir>
                     default = /tmp/.oscam
        -d <level> : debug level mask
                       0 = no 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
                     255 = debug all
        -r         : restart level
                       0 = disabled, restart request sets exit status 99
                       1 = restart activated, web interface can restart oscam (default)
                       2 = like 1, but also restart on SEGFAULTS
        -h         : show this help

Example script for start/stop

#!/bin/sh
# 2011/01/26 - OSCam Start/Stop-Example
#
# Examples *************************************************
# <PATH_TO_SCRIPT>/<SCRIPT_NAME> <PARAMETER>
# /var/emu/oscam.sh stop
# /var/emu/oscam.sh start
# /var/emu/oscam.sh reload (same as "start" or "restart")
#
# USER SETUP ###############################################
# ----------------------------------------------------------
# Path to the camd binaries - without trailing slash!
# Example: camd_path='/var/emu'
camd_path='/var/emu'
# ----------------------------------------------------------
# Path to the camd configuration files - without trailing slash!
# Example: camd_c_path='/var/keys'
camd_c_path='/var/keys'
# ----------------------------------------------------------
# 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='/tmp/camd.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='UNKNWON OR MISSING PARAMETER!'
        echo "$msg"
        echo "$hr" >> $camd_logfile
        echo `date`": $msg" >> $camd_logfile
        exit 1
    ;;
esac
exit 0

OSCam Reloaded

Reloading the user database:

kill -1 `pidof oscam`

Reloading the card information:

killall -SIGUSR2 oscam

Miscellaneous

Script to determine number of readers:

r=0
if [ -d "/tmp/.oscam" ]; then
    r=$(ls -l /tmp/.oscam/reader* | wc -l)
fi
echo $r


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

LanguageDE S.png [[OSCam/de/{{#titleparts:OSCam/en/ShellCommands|3|3}}|Deutsch]] LanguageEN S.png [[OSCam/en/{{#titleparts:OSCam/en/ShellCommands|3|3}}|English]] LanguageFR S.png [[OSCam/fr/{{#titleparts:OSCam/en/ShellCommands|3|3}}|Français]] LanguageIT S.png [[OSCam/it/{{#titleparts:OSCam/en/ShellCommands|3|3}}|Italiano]]