Results 1 to 3 of 3

Thread: Cron script to check if OSCam is running with auto restart

  1. #1
    Webmaster Sat-TV's Avatar
    Join Date
    03-03-2005
    Posts
    3,436
    Uploads
    1,669

    Question Cron script to check if OSCam is running with auto restart

    As more and more peeps are required to take the plunge with oscam here is a simple script which will check to see if oscam is running.
    If oscam has stopped running it will restart it automatically.

    Code:
    #!/bin/sh
    
    process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo "Couldn't find oscam running. Restarting server-binary" >> /var/log/oscam.check
    nohup /usr/local/bin/oscam >> /var/log/oscam.log &
    else
    echo "oscam is still OK!" >> /var/log/oscam.check
    fi
    You must make sure that your oscam binary is indeed located in /usr/local/bin.
    If it's not, adjust the script accordingly.


    Now just configure cron to run the script say every 5 minutes.

  2. #2
    New Member
    Join Date
    17-02-2015
    Posts
    3
    Uploads
    0

    Re: Cron script to check if OSCam is running with auto restart

    Hi, it's an old thread I know, but my question is valid the same, I suppose:
    what if I'd like to restart it anyway, even if it's already running?
    I tried just this part of your script
    nohup /usr/bin/oscam >> /var/log/oscam.log

    (where I obviously changed the bin path)

    Thanks

  3. #3
    Your Nigerian Prince CapNCooK's Avatar
    Join Date
    10-03-2012
    Location
    Earth
    Posts
    329
    Uploads
    4

    Re: Cron script to check if OSCam is running with auto restart

    If you just want to force-restart oscam;

    Code:
    #!/bin/sh
    
    process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo "Couldn't find oscam running. Restarting server-binary" >> /var/log/oscam.check
    nohup /usr/local/bin/oscam >> /var/log/oscam.log &
    else
    echo "oscam is still OK - but you wanted to restart it anyways, and so we do.." >> /var/log/oscam.check
    killall -9 oscam >> /var/log/oscam.check 
    sleep 2 
    nohup /usr/local/bin/oscam >> /var/log/oscam.log &
    fi

Similar Threads

  1. Oscam auto restart DM-500
    By turbopower in forum Oscam
    Replies: 6
    Last Post: 09-02-2014, 22:59:38
  2. CCcam / oscam Check - Restart
    By wahid in forum OSCam
    Replies: 4
    Last Post: 23-06-2013, 18:41:03
  3. Tutorial CCcam Auto Restart Script
    By totox69 in forum Information et Tutoriels
    Replies: 4
    Last Post: 28-03-2011, 12:53:23
  4. Cccam Restart Script FOR-GEMINI
    By <warrior> in forum CCcam Software and Tools
    Replies: 2
    Last Post: 23-11-2009, 13:19:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •