OSCam Startup Script for Ubuntu and other linux distros

Updated on 07.01.2014

Create a file called /etc/init.d/oscam with the following contents:

This assumes that you have the oscam binary located in /usr/local/bin/oscam. Remember you have to create this file as the root user.

To “enable” the script and the starting up of oscam on reboot, use the following commands on Ubuntu/Debian:

Furthermore, for a simple crontab script to check if oscam has crashed and didn’t restart by itself, let’s create a file and call it /usr/local/bin/oscamchk: And let’s make this run every minute:
Once the crontab editor has started, add the following line:
  • SEb

    small typo here:

    DEAMON_OPTS=”-b -p 255 -w 5 -r 2″

    should be DAEMON_OPTS

  • Marcin

    Thank you for the script !!!

    I am a total Linux newbie.

    I am a bit confused here and I was hoping you could enlighten me.

    The binary that I am using for Oscam on my Debian PC is called “Oscam.x86” and not just “oscam”.

    Could you please tell me how I should change the script to reflect that ?

    The binary I am using is located in the same folder as your binary in your example.

    • You need to change this line:

      DAEMON=/usr/local/bin/oscam

  • sagit524

    hi… nice script. ty so much. but, what is oscam -b -p 255 -w 5 -r 2 means? thanks for the explaination

    • Woah, sorry I’m seeing this so late

      -b, --daemon            | Start in the background as daemon. -p, --pending-ecm <num> | Set the maximum number of pending ECM packets.                         . Default: 32 Max: 255 -w, --wait <secs>       | Set how much seconds to wait at startup for the                         . system clock to be set correctly. Default: 60 -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.

  • Tonio20

    hello my friend,
    with putty
    type: sudo /etc/init.d/oscam restart
    the answer is not good
    Here’s what its gives:
    root@ubuntu:~# sudo /etc/init.d/oscam restart
    * Stopping OScam… [ OK ]
    * Starting OScam… [fail]
    oscam is blocked !!!!
    can correct you this error?
    Best regards

    • I would need more info. Is your oscam binary located at /usr/local/bin/oscam?

      can you type /usr/local/bin/oscam –help and see what you get back?

  • Tonio20

    root@tonio:~# /usr/local/bin/oscam –help
    ___ ____ ___
    / _ / ___| / __|__ _ _ __ ___
    | | | ___ | | / _ | '_ _
    | |_| |___) | |_| (_| | | | | | |
    ___/|____/ _____,_|_| |_| |_|
    OSCam cardserver v1.20-unstable_svn, build r9872 (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 | Read configuration files from .
    . Default: /usr/local/etc
    -t, –temp-dir | Set temporary directory to .
    . Default: /tmp/.oscam
    Startup:
    -b, –daemon | Start in the background as daemon.
    -B, –pidfile | Create pidfile when starting.
    -r, –restart | 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 | Set how much seconds to wait at startup for the
    . system clock to be set correctly. Default: 60
    Logging:
    -I, –syslog-ident | Set syslog ident. Default: oscam
    -S, –show-sensitive | Do not filter sensitive info (card serials, boxids)
    . from the logs.
    -d, –debug | 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 | 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 | 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.

  • Tonio20

    Hello

    my oscam bin is in /usr/local/bin/

    In your line 29, you have
    /usr/bin/killall-9 oscam !!!!
    should we put — / usr/local/bin/killall – 9 oscam
    regards

    • If your “killall” is in /usr/local/bin, you have serious issues.

      • Tonio20

        OK, thanks I understood this line
        regards

  • alexis

    Una vez que el editor de crontab ha comenzado, agregue la siguiente línea: Pero esa linea donde la copio ?? que archivo ?? bueno ojala me puedan ayudar . saludos
    1* * * * * /usr/local/bin/oscamchk >/dev/null 2>&1 EsESa linea

    • No idea what you just said.