View Full Version : Black Hole Cron Manager
zola25
14-06-2010, 08:28 AM
Hi all
I am using the Dream Elite image and i am trying to add a script to restart cccam if it stops running.
First i added the script to usr/script (is that the right place?) and set the attribute to 755
Then i added a custom command in cron manager called ccheck.sh
This is the script i am using but does not seem to work so should the script be put somewhere else?
#!/bin/sh
if ps x |grep -v grep |grep -c CCcam_214 >/dev/null
then
echo "cccam... ok"
else
echo "cccam... restarting"
/usr/bin/CCcam_214
fi
Hope someone can help
zola25
14-06-2010, 11:14 AM
Ok found one error should be /usr//bin/CCcam_214
The script runs fine from telnet i just need to know the correct folder the cron manager looks in for scripts
zola25
14-06-2010, 08:43 PM
Any ideas people still cant find the folder
zola25
15-06-2010, 08:08 AM
Ok given up with the cron manager could someone tell me how to get enigma to run this script at startup
#!/bin/sh
if ps x |grep -v grep |grep -c CCcam_214 >/dev/null
then
echo "cccam... ok"
else
echo "cccam... restarting"
/usr/bin/CCcam_214
fi
Must be a easy way but i cant find it
just ask on their site as they being developers would answer you better
sonic1
15-06-2010, 12:26 PM
#!/bin/sh
if ps x |grep -v grep |grep -c CCcam >/dev/null
then
echo "cccam... ok"
else
echo "cccam... restarting"
/var/bin/CCcam_214 &
fi
I have not tested but I believe that you are correct in your first post in the way you are trying.
You do not need the CCcam version in the first line.
Also basic test to see if the script works is add to usr/script and chmod 755 then green button > blue button and this should run the script once.
If you still have problems I will look and test myself when I get home.
zola25
15-06-2010, 12:39 PM
I tested the script and that works fine i am just having problems with the cron manager i tried to add this line in etc/bhcron
*/10 * * * * /usr/script/ccheck.sh
which i thought would run it every 10 minutes but it did not work.
I have found a plugin called cccamwatchdog thats works unless you reboot then you have to start it again via the plugin panel as it was written for oe 1.5
sonic1
15-06-2010, 02:17 PM
With cron manager you should be able to just specify your own script which you could call CCcamcheck.sh cron manger should then look in usr/script folder for your script.
But I will test tonight to be sure.
sonic1
15-06-2010, 10:10 PM
Please test this and report back to me.
I have used a script from my friend youknowhoo
This is for CCcam 2.1.3 so instead of changing what I have packed please test with CCcam 2.1.3
If it works I will amend and pack for whatever version you need.
FTP to tmp and add via manual install addons.
sonic1
16-06-2010, 07:24 PM
I will give a few more hours and then remove the file, no feed back and zola was online this morning.
Clearly wasting my time again.
zola25
16-06-2010, 08:01 PM
Sorry mate
You are not wasting your time i downloaded the file this morning but had to go to work so could not test it then.
I tried it with cccam 213 and it works fine so thanks for the effort,you do not need to change the script i will stay with that version of cccam.
I can now get rid of cccamwatchdog as it does only seem to work sometimes but i suppose that is because it was written for oe1.5 .
Anyway thanks again for the help sonic1
PS
Maybe you should leave the file up in case anyone else has similar problems
sonic1
16-06-2010, 08:10 PM
OK, thanks for the feedback zola.
The only thing that concerns me is if you look at the log in etc/cccamlog then the file will grow at an alarming rate with the current check time.
I would suggest you increase the time between checks and I will also add a little script to delete the log manually.
zola25
16-06-2010, 08:27 PM
Thanks that would be great i have increased the time to every hour for now
malsat
16-06-2010, 09:47 PM
@zola
am I right in putting this script into /usr//bin/CCcam_214 then in cron manager CCcamcheck.sh ?
zola25
17-06-2010, 04:17 AM
Hi m*****
put them in the same folders as the unzipped file lists any folders that are not in the stb just create new folders.
zola25
17-06-2010, 04:19 AM
Why is your user name censored m*****?
sonic1
17-06-2010, 08:45 AM
@zola
am I right in putting this script into /usr//bin/CCcam_214 then in cron manager CCcamcheck.sh ?
If you use the file I have posted it puts all the files in the right folders and will give them the correct attributes.
There is no way you can get it wrong this way.
sonic1
17-06-2010, 08:46 AM
Why is your user name censored m*****?
After the M I think you will find the name of another sat related board. :smilielol5:
malsat
17-06-2010, 10:23 AM
Thanks sonic zola
I will try again tonight after work,
can you do it for CCcam 2.1.4 ?
sonic1
17-06-2010, 10:28 AM
Thanks sonic zola
I will try again tonight after work,
can you do it for CCcam 2.1.4 ?
I will do it tonight when I get home.
zola25
17-06-2010, 02:12 PM
maybe it is just me but i find 2.1.3 a bit more stable than 2.1.4
sonic1
17-06-2010, 09:40 PM
Here is 2.1.4 please test and confirm it is ok.
@zola
Instead of a delete script would you prefer the log to go to USB or HDD maybe ?
zola25
18-06-2010, 07:02 AM
@Sonic1
It would be nice for the logfile go to the usb stick so you do not have the hardisc spinning up and down.
Thanks for all your time sonic1
malsat
18-06-2010, 07:16 PM
ok so I have ftp the 2 files with DCC into my duo,set the cron manager to check every 15 mins fo CCcamcheck.sh,
Is that it ?how do I tell its ok ?
sonic1
18-06-2010, 07:52 PM
The file I posted for 2.1.4 you just ftp to tmp and do a manual install.
Then check etc/cccamlog to see what is going on.
malsat
18-06-2010, 10:52 PM
thanks sonic,
cant see cccamlog in etc
malsat
19-06-2010, 12:11 AM
ok working thanks
did you say you can do log to HDD ?
or can I delete log ?
zola25
19-06-2010, 07:23 AM
You can just delete the log contents
malsat
21-06-2010, 05:44 PM
My cccam has been down since 1:30 untill now today,in the cccamlog it says not found restarting but never started,
what do I need to do ?
sonic1
21-06-2010, 06:43 PM
I will pack the file with a different script which you can try.
Do you have a USB stick install ?
malsat
21-06-2010, 11:53 PM
yes I do
thanks sonic1
zola25
22-06-2010, 04:18 AM
Hi m*****&sonic
I just checked the script and found the same says restarting but nothing happens but i found the problem i think.If you check the script replace the line /usr/bin/CCcam-213 with this /usr/bin/CCcam_213 and it should work
I tested it by switching cams to common interface and it restarted itself so should be fine now
#!/bin/sh
#DESCRIPTION=This script checks to see if CCcam is running ok
#this script is written By youknowhoo
#i have added a part that checks if CCcam is responding like it should
#that part is written by CC_share.
#this way you can see if it was off(line) or frozen
CHECKNAME="test.txt"
IP="127.0.0.1"
PORT="16000"
process=`ps auxwww | grep CCcam_213 | grep -v grep | awk '{print $1}'`
if [ -z "$process" ]; then
echo "Couldn't find CCcam_213 running, Restarting CCcam" **** /usr/cccamlog/cccam.check
echo && date ****/usr/cccamlog/cccam.check
/usr/bin/CCcam-213
else echo "CCcam process is present, now checking if CCcam is frozen" **** /usr/cccamlog/cccam.check
sleep 10
echo info|nc $IP $PORT ****/tmp/test.txt
set $(ls -s /tmp/test.txt)
if [ "$1" = "0" ];
then
echo "CCcam is frozen, restarting CCcam" ****/usr/cccamlog/cccam.check
echo && date ****/usr/cccamlog/cccam.check
/usr/bin/CCcam_213
else
echo "Cccam is responding like it should" ****/usr/cccamlog/cccam.check
fi
rm /tmp/$CHECKNAME
fi
malsat
22-06-2010, 08:50 AM
It worked for me zola
thanks again guys
malsat
22-06-2010, 02:38 PM
Is there a way to find out why cccam stopped ?
zola25
22-06-2010, 04:14 PM
Wish i new the answer to that seems to happen for no reason that i can see
sonic1
22-06-2010, 04:40 PM
Wish i new the answer to that seems to happen for no reason that i can see
The common cause is a bad peer, start CCcam with telnet and check the log.
It can be time consuming.
PS I will repack those files tonight with your correction zola.
loveman
22-06-2010, 06:16 PM
I'm guessing the line:
/usr/bin/CCcam-213
Just starts CCcam again?!
Surely, the best way of restarting the cam is to use:
/usr/camscript/Ncam_CCcam2.1.3.sh start
Anyway, just thought would add that in case sonic wanted to change it?!
zola25
22-06-2010, 07:10 PM
Hi sonic1
What command in telnet to create a log file and where is the logfile located.
I still a bit out of my depth with linux
sonic1
22-06-2010, 07:33 PM
Hi sonic1
What command in telnet to create a log file and where is the logfile located.
I still a bit out of my depth with linux
I am not quite sure I understand your question, what do you want to create a logfile for ?
Once you know what you are creating it for you specify the path.
Trust me I am no expert either but I am reading and learning from trial and error.:ack2:
sonic1
22-06-2010, 08:05 PM
Here are two corrected files for auto install, the log will now be in media/usb
For those interested these will also work fine in your dreambox running DE e2 images.
Please check and report back.
malsat
22-06-2010, 10:23 PM
Hi sonic
If I leave the log as it is not usb and empty it every other day will it be ok ? Im checking every 10 mins,any idea how many days before its full ?
I have a 250GB HDD in my duo if that makes any difference.
hope this makes sence
sonic1
23-06-2010, 08:14 AM
If you empty every day that will be fine, the size of your HDD makes no difference as it is not being stored there.
I have also incresed the check time to every 60mins as I think 10 mins is too often.
malsat
27-06-2010, 09:07 PM
@sonic
I am now wanting to read card in oscam,is it ok to have the cccamcheck .sh running or is there one to start oscam first?
I can't aford to burn my viasat card again.
sonic1
28-06-2010, 04:20 PM
I have never used Oscam but here is a scrip for Debian, you will have to modify it for Vu + Duo
All credits to meigrafd
#!/bin/sh
#
# 06.2010 by meigrafd
#
#
## Recommended HowTo:
#
# Add a new shell user and install there your Oscam:
#
# useradd -m -s/bin/bash CS
# su - CS
# mkdir Oscam
#
# Copy your files as followed: (inc. this script as: OSCAM)
#
# Oscam/
# oscam OSCAM oscam.conf oscam.server oscam.services oscam.srvid oscam.user
#
# Add some cronjob entry so Oscam gets started on reboot and gets checked every minute:
#
# nano $HOME/.cron
#
# @reboot $HOME/Oscam/OSCAM start >/dev/null 2>&1
# * * * * * $HOME/Oscam/OSCAM check >/dev/null 2>&1
#
# crontab $HOME/.cron
#
# ...Feel free to change the paths...
# ...which depends on your receiver/system/image...
#
### CONFIG - START
# Enable colored output-lines on shell? [yes/no]
ENABLECOLORS="yes"
# Path where the Oscam binary lies, no trailing / [Oscam-default: /var/emu]
OScamPATH="$HOME/Oscam"
# Name of the Oscam binary [Oscam-default: oscam]
OScamBIN="oscam"
# Options to start Oscam with [Oscam-default: <none>]
# NOTE: you MUST set "-c /path/to/Oscam" if its NOT Oscam-default!
# NOTE: DON'T edit unless you know what you are doing!
OScamOPTIONS="-b -c $OScamPATH"
# Where your Oscam-log is located if enabled?
OScamLOG="/tmp/oscam.log"
### CONFIG - END
if [ "$ENABLECOLORS" = "yes" ]; then
ROT=`tput setaf 1`
GRUEN=`tput setaf 2`
BOLD=`tput bold`
NORM='tput op && tput sgr0'
else
ROT="" ; GRUEN="" ; BOLD="" ; NORM=""
fi
# This method starts OScam
start_cam ()
{
if ps x |grep -v grep |grep -c $OScamBIN >/dev/null
then
echo $ROT "ERROR: $OScamBIN still runs with pids: $(pidof $OScamBIN) ..." ; $NORM
else
cd $OScamPATH
./$OScamBIN $OScamOPTIONS
echo $GRUEN "Successfully started OScam ($OScamOPTIONS) with pids: $(pidof $OScamBIN)" ; $NORM
fi
}
# This method stops OScam
stop_cam ()
{
PiDS=$(pidof $OScamBIN)
if [ -z "$PiDS" ]; then
echo $ROT "ERROR: Cant see $OScamBIN to stop..." ; $NORM
else
echo $GRUEN "Stopping OScam with pids: $PiDS" ; $NORM
for pid in $PiDS
do kill -9 $pid
done
fi
}
# This method checks for running process and starts if not...
check_run ()
{
if ps x |grep -v grep |grep -c $OScamBIN >/dev/null
then
echo $GRUEN "Seems OScam still runs with pids: $(pidof $OScamBIN) ..." ; $NORM
else
echo $ROT "Cant see OScam... Restarting!" ; $NORM
start_cam
fi
}
# This method watches the $OScamLOG in realtime...
monitor_log ()
{
if [ ! -e $OScamLOG ]; then
echo $ROT "ERROR: Cant find Oscam log $OScamLOG ... Is it enabled?" ; $NORM
else
echo " "
echo "Starting monitoring of $OScamLOG in realtime. Hit STRG + C to abort!"
echo " "
tail -f $OScamLOG
fi
}
proc_exit() {
rm -f "/tmp/CCcamCheck.lock"
exit 0
}
if [ -e "/tmp/OscamCheck.lock" ]; then
if [ "`find \"/tmp/OscamCheck.lock\" -type f -mmin -5`" ]; then
echo "Lockfile /tmp/OscamCheck.lock exists and is not 5 minutes old yet. Quitting!"
exit 0
else
echo "Lockfile exists, but its older then 5 minutes. Removing lockfile."
touch "/tmp/OscamCheck.lock"
fi
else
touch "/tmp/OscamCheck.lock"
fi
case "$1" in
start)
echo "[SCRIPT] $1:"
start_cam
;;
stop)
echo "[SCRIPT] $1:"
stop_cam
;;
restart)
echo "[SCRIPT] $1:"
stop_cam
sleep 5
start_cam
;;
check)
echo "[SCRIPT] $1:"
check_run
;;
log)
echo "[SCRIPT] $1:"
monitor_log
;;
*)
echo "Usage: $0 {start|stop|restart|check|log}"
;;
esac
proc_exit
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.