Results 1 to 4 of 4

Thread: Два оскам-а на едно pc

  1. #1

    Два оскам-а на едно pc

    Днес попаднах, на една тема във форума на оскам, в която се коментираше, дали е възможно да се пуснат два оскам-а на една линукс машина. Това ме провукира да пробвам и аз. Промених директорията на конфига на втория оскам и както изглежда, двата кама работят нормално. Срещнах проблеми само с конфигурацията на чекващия скрипт. За това реших да пиша и тук.
    Това е скрита, който работи перфектно с един осакм:
    Code:
    while sleep 2
    do
      if ps x | grep -v grep | grep -c oscam >/dev/null
      then
    	echo "oscam already running"
      else
    	echo ""
    	date >> /tmp/oscam-crash.log
    	echo "oscam loeppt nicht, wird gestartet" >> /var/cccamlog/oscam.check
    	killall oscam
    	sleep 1
    	/usr/local/bin/oscam -b &
      fi
    done

    Пробвах да го повторя още веднъж, като пременя пътищата до втория оскам по този начин:
    Code:
    while sleep 2
    do
      if ps x | grep -v grep | grep -c oscam >/dev/null
      then
    	echo "oscam already running"
      else
    	echo ""
    	date >> /tmp/oscam-crash.log
    	echo "oscam loeppt nicht, wird gestartet" >> /var/cccamlog/oscam.check
    	killall -9 oscam 
    	sleep 1
    	/usr/local/bin/oscam -b &
      fi
      while sleep 2
    do
      if ps x | grep -v grep | grep -c oscam_2 >/dev/null
      then
    	echo "oscam already running"
      else
    	echo ""
    	date >> /tmp/oscam-crash.log
    	echo "oscam loeppt nicht, wird gestartet" >> /var/cccamlog/oscam.check
    	killall -9 oscam_2 
    	sleep 1
    	oscam_2 -b -c /usr/local/etc/config2 &
      fi
    done
    Това обаче, не е правилно, защото, ми дава съобщение за синтактична грешка.

    Молбата ми е: ако някой има желание да каже, как да редактирам скрипта, да чеква и двата осакм-а!?

    Весели Празници на всички!

  2. #2
    Super Moderator turbopower's Avatar
    Join Date
    02-07-2011
    Location
    Somewhere between the Streams
    Posts
    3,515
    Uploads
    113

    Re: Два оскам-а на едно pc

    Code:
    while sleep 2
    do  
    if ps x | grep -v grep | grep -c oscam >/dev/null  
    then    
    echo "oscam already running"  
    else    
    echo ""    
    date >> /tmp/oscam-crash.log    
    echo "oscam loeppt nicht, wird gestartet" >> /var/cccamlog/oscam.check    
    killall -9 oscam     
    sleep 1    
    /usr/local/bin/oscam -b &  
    fi  
    sleep 5  
    if 
    ps x | grep -v grep | grep -c oscam_2 >/dev/null  
    then    
    echo "oscam already running"  
    else    
    echo ""    date >> /tmp/oscam2-crash.log    
    echo "oscam loeppt nicht, wird gestartet" >> /var/cccamlog/oscam2.check    
    killall -9 oscam_2     
    sleep 1    
    oscam_2 -b -c /usr/local/etc/config2 &  
    fi
    done
    С този скрипт трябва да стане Как да нямам желание да ти помогна, оскам секцията във форума ми е зачислена на мен

    Весели Празници!

  3. #3
    Super Moderator turbopower's Avatar
    Join Date
    02-07-2011
    Location
    Somewhere between the Streams
    Posts
    3,515
    Uploads
    113

    Re: Два оскам-а на едно pc

    Code:
    #!/bin/bash
    if ! ps x |grep -v grep |grep -c "oscam-4724 -b -c /usr/local/etc/" >/dev/null 
     then
     /var/script/oscript start
     echo `date "+%d/%m/%y %R process was not working"` >> /var/tmp/oscam_restart_log
    # This part above will check if there is NO oscam process running.
    # And if this condition it truth, it will start it and write to log.
    # Log entry will contain time stamp and reason of execution (process not working)
    # If first condition in not truth (oscam was running), go further to next condition.
    elif 
     tail -8 /var/tmp/oscam.log |grep -v grep |grep -c ins40 >/dev/null
    then
     /var/script/oscript restart
     echo `date "+%d/%m/%y %R ins40 error detected"` >> /var/tmp/oscam_restart_log
    elif
     tail -8 /var/oscam.log |grep -v grep |grep -c trylock >/dev/null
    then
     /var/script/oscript restart
     echo `date "+%d/%m/%y %R trylock error detected"` >> /var/log/oscam_restart_log
    # Those 2 conditions will look for 2 common errors in Oscam: "ins40" and "trylock"
    # If last 8 lines of your oscam.log contain any of those errors, it will restart oscam.
    # Log entries will include the exact reason of restart.
    # ins40 error is random error that will keep oscam running but no CWs returned.
    # trylock is older error that appear if you use CCcam protocol in oscam.server   
    else
     echo "ok"
    # If oscam passes all conditions and all is OK, it will simply echo "ok" :-)
    fi
    # ENJOY - supermariocs

    Това е скрипта който използвам има още няколко доп екстри

  4. #4

    Re: Два оскам-а на едно pc

    Здрасти Боби,

    Моднах един скрипт, който беше за ццкам и нещата се получиха:
    Code:
    process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo && date >> /var/cccamlog/oscam.check
    echo "Couldn't find oscam running. Restarting server-binary" >> /var/cccamlog/oscam.check 
    /usr/local/bin/oscam -b
    else echo "Oscam is still OK!" >> /var/cccamlog/oscam.check 
    fi 
    sleep 2
    process=`ps auxwww | grep oscam_2 | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo && date >> /var/cccamlog/oscam.check
    echo "Couldn't find oscam running. Restarting server-binary" >> /var/cccamlog/oscam.check 
    oscam_2 -b -c /usr/local/etc/config2 &
    else echo "Oscam is still OK!" >> /var/cccamlog/oscam.check 
    fi
    Вероятно утре ще пробвам и твоите...

Similar Threads

  1. Replies: 20
    Last Post: 21-12-2011, 00:04:49
  2. Replies: 0
    Last Post: 30-08-2011, 16:22:03
  3. Replies: 14
    Last Post: 21-05-2009, 18:36:15
  4. Кокс сообщений для запуска одиннадцать н
    By erdoganeng in forum Russian / Русский
    Replies: 0
    Last Post: 30-11-2008, 06:30:13

Posting Permissions

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