PDA

View Full Version : Please help need script to restart



Jules
21-11-2015, 04:25 PM
Hi Guys,
Hope someone can help me please.
My VU+ Duo cam drops out every so often.
Can someone help me with a script that will auto restart it if it stops?

Thanks.
Regards,
Jules.

mrdude
21-11-2015, 04:44 PM
Make a script similar to this:



#!/bin/sh
# DESCRIPTION=This script starts oscam on boot & checks it's running every 30 seconds.
#--------------------------------
# Check Oscam Is Running

SERVICE='oscam'

while true
do
if ps w | grep -v grep | grep $SERVICE > /dev/null
then
echo "oscam is running"
else
echo "oscam is not running - starting now"
cd /
/etc/oscam/oscam.sh start
fi
sleep 30
done


The script above checks to see if oscam is running - if not it executes: /etc/oscam/oscam.sh start

Change that bit to execute your own script that runs oscam.

Once done if you want this script to run at boot time - put it here:

/etc/rc3.d/S100oscamcheck.sh

Jules
21-11-2015, 04:47 PM
Thanks for reply mrdude.
I am using CCcam.
Do I use your script and just change Oscam to CCcam please?

Jules
22-11-2015, 12:30 AM
Thanks for this ozzsurf,
What do I need to remove again please?

Jules
22-11-2015, 01:03 AM
Sorry, silly me, I understand now thanks.
What does the * * * * indicate?

Jules
22-11-2015, 03:15 PM
Thanks for advice

Jules
22-11-2015, 08:39 PM
Hi ozzsrf I have installed your attached file to user/script folder.
do I now add this line with ftp please:
*/1 * * * * /usr/script/cccam.check.sh

Thanks,
Jules.

Jules
23-11-2015, 12:20 AM
Hi, I am using BH image

Jules
23-11-2015, 10:35 AM
Thanks ozzsurf,
looking at cam menu, this is my cam: CCcam_2.3.0

Jules
23-11-2015, 01:14 PM
please can you confirm I put your file "cccam.check.sh"
into usr/script folder

And I put line "*/1 * * * * /usr/script/cccam.check.sh"
into usr/bin as a txt file?

Thanks

Jules
23-11-2015, 01:43 PM
Thanks very much.
I can see in these folders there is already this line:
*/5 * * * * /usr/script/./ccheck.sh
Do I leave that in?

Jules
23-11-2015, 02:36 PM
Thanks I have done that. So now I only have that one line in bh.cron and root.

Is that correct?

Jules
23-11-2015, 03:19 PM
Thanks for your help ozzsurf, much appreciated!
I suppose the only way to test if working on mine now is to wait and see?
Just another question, will this use a lot of memory in my box, or can I change the check time by changing the number of minutes in:
*/1 * * * * /usr/script/cccam.1min-check.sh
Or am I best just leaving as it is?
Thanks.

mrdude
23-11-2015, 03:30 PM
Thanks for your help ozzsurf, much appreciated!
I suppose the only way to test if working on mine now is to wait and see?
Just another question, will this use a lot of memory in my box, or can I change the check time by changing the number of minutes in:
*/1 * * * * /usr/script/cccam.1min-check.sh
Or am I best just leaving as it is?
Thanks.

You can test it by tel-netting into your box and killing CCcam then check to see if it starts again:

Telnet command to see if CCcam is runnning:



cd /
ps -A


Telnet command to kill CCcam


cd /
killall -9 CCcam

or

killall -9 CCcam_2.3.0



Wait and enter the fist command again to see if the CCcam process starts automatically.

seamouse
23-11-2015, 03:33 PM
if using vix, there is a auto start on start up, but if the cam is dropping out dueing the day for no reason, try a new one

Jules
23-11-2015, 04:48 PM
Sorry seamouse telnet rejects these commands

Jules
23-11-2015, 09:19 PM
Hi ozzsurf,
Thanks for reply.
I just killed cam but it did not restart.
Looked in usr/bin and ccam is like this:
"CCcam_2.3.0"

Should have worked?

Jules
24-11-2015, 12:02 AM
Thanks ozzsurf have checked and I can see that the code line you sent before was:
*/1 * * * * /usr/script/cccam.1min.check.sh
The one you just showed me is:
*/1 * * * * /usr/script/cccam.1min-check.sh

diffrerence is "-" and "." after "1min, can you see?
will that make a difference?

Jules
24-11-2015, 12:09 AM
Did you see you put a "-" instead "." ?
See the difference in the 2 lines you sent:

*/1 * * * * /usr/script/cccam.1min.check.sh

*/1 * * * * /usr/script/cccam.1min-check.sh

Cheers, Jules.

Jules
24-11-2015, 12:15 AM
I just need to change the . to a - after 1min.
Do you see just before the word "check"?

*/1 * * * * /usr/script/cccam.1min.check.sh


*/1 * * * * /usr/script/cccam.1min-check.sh

Jules
24-11-2015, 12:25 AM
thanks I will change them both to a "-" and try in the morning.

Thanks again.

Jules
24-11-2015, 11:53 AM
Hi ozzsurf,
I have made the commands right tried it both ways cam still will not start itself.
I am sure I have done everything as you said.

Jules
24-11-2015, 01:38 PM
Thanks for sticking with me on this.
I'll try now.

Jules
24-11-2015, 01:45 PM
I have done that when I telnet the command it says " cccam... ok
but cam dows not start

Jules
24-11-2015, 02:15 PM
Yes cccam stops when I kill it.

Jules
24-11-2015, 02:37 PM
I have done that and it cccam... ok
but it does not start.

I see you typed ccCam
I have it as CCcam

Jules
24-11-2015, 02:39 PM
when I telnet chmod 755 /usr/script/cccam.1min-check.sh
It syas no such directory

Jules
24-11-2015, 02:41 PM
I telnet again with chmod 755 /usr/script/cccam.1min-check.sh
and no errors, cmd prompt back ok

Jules
24-11-2015, 02:43 PM
I have it as CCcam.1min-check.sh

Jules
24-11-2015, 02:50 PM
this is what I have in usr/script:
CCcam.1min-check.sh

Jules
24-11-2015, 02:58 PM
I will need to rename in etc/bhcron aswell?

Jules
24-11-2015, 03:00 PM
OK sorry I will do all that.
Forgive me for being daft!!

Jules
24-11-2015, 03:08 PM
Ok I have telnet
chmod 755 /usr/script/cccam.1min-check.sh

Now back to command promt

Jules
24-11-2015, 06:52 PM
Thanks ozzsurf!! says cam is restarting and it has done!!
Thank you, sorry for the confusion and thanks for your time.
Does this mean now the script will work and it will check the cam check every minute?

Jules
24-11-2015, 07:27 PM
Thanks, I have doen that but cam not starting I see in your code line above you typed cccam all lower case, is that why?

mrdude
24-11-2015, 07:57 PM
:iagree:

LOL, this has to be one of the funniest threads I've read in ages - you can lead a horse to water, but you can't make it drink!

@ozzsurf - you have the patience of a saint m8.

Jules - @ this rate you'd be faster sending your box to ozzsurf (via china) and getting him to do it for you.

Jules
24-11-2015, 08:14 PM
Sorry Guys, I am a little confused because earlier in this thread I am sure Isaw captal C's in the commands?
OK so, I've got it now. NO captal C anywhere!!

mrdude
24-11-2015, 08:27 PM
Sorry Guys, I am a little confused because earlier in this thread I am sure Isaw captal C's in the commands?
OK so, I've got it now. NO captal C anywhere!!

I think you're telling porkies - and you'll be back in this thread in a little while, this time asking about changing the script and adding bits and bobs to it. :-)

Jules
24-11-2015, 08:30 PM
I am trying honestly lol

Jules
24-11-2015, 08:45 PM
Hi ozzsurf, please can you take me through from beginning one more time?
I will give it by best attention.
Thanks.

Jules
24-11-2015, 09:07 PM
Sorry I misunderstood Guys,
Thanks for help anyway.
Please close thread.