Page 1 of 1

Cronjob - Restart vicidial

PostPosted: Wed Feb 26, 2014 2:37 am
by phil_discount
Hello,

i just want to restart vicidial with a cronjob every morning, i can't do a reboot.
if i execute the script vom command line, it works, but as a cronjob -it doesen't.
i tried the following
Code: Select all
0 5 * * * /etc/init.d/vicidial restart
0 5 * * * bash -c "/etc/init.d/vicidial restart"


i only see this in /var/log/messages
Code: Select all
Feb 26 08:28:02 ka-vici-demo kernel: [ 1763.217380] dahdi: Telephony Interface Unloaded
Feb 26 08:28:02 ka-vici-demo kernel: [ 1763.609981] dahdi: Telephony Interface Registered on major 196
Feb 26 08:28:02 ka-vici-demo kernel: [ 1763.609987] dahdi: Version: 2.3.0.1
Feb 26 08:28:05 ka-vici-demo kernel: [ 1766.629007] dahdi: Registered tone zone 0 (United States / North America)

asterisk stops, but nothing else.

i'm using vicibox redux 3.0.5

regards
philip

Re: Cronjob - Restart vicidial

PostPosted: Wed Feb 26, 2014 3:35 pm
by williamconley
If you are not going to perform a reboot, you are wasting time trying to restart Vicidial and more likely to cause problems than to solve them.

A reboot will unquestionably clean out everything. Attempting to restart individual processes without rebooting will likely break links and cause errors that may last beyond your attempt, having the opposite effect of your goal.

You could restart services (mysql, apache2, etc), but even that will cause errors and this is linux, any error could leave a broken link or memory lock (there is so much interaction between packages in this system that a hiccup is inevitable from this process if you do it enough times).

So my advice: If you can't reboot, don't mess with it.

Re: Cronjob - Restart vicidial

PostPosted: Wed Feb 26, 2014 6:27 pm
by phil_discount
i know what u mean.
but i've got problems with starting one server. sometimes he hangs while initialzing memory.
the new server comes in 2 weeks. until the the server is installed i don't want to reboot the server.
just in the morning a reload of vicidial.

the script from console works fine, so i just thought there is a litte mistake in my crontab to restart vicidial.

and sometimes asterisk stops without any hint. i made a cronjob who checks asterisk every minute and restarts vicidial if asterisk is down.
not optimal, but better than do it manually.

Re: Cronjob - Restart vicidial

PostPosted: Wed Feb 26, 2014 7:59 pm
by williamconley
replace your memory (and cross your fingers)

if you have more than 4G ... take half out. if it crashes again, put those back and take out the other half.

and hope it's not your HD, but get a GOOOOOOOD backup OFF that server immediately (and nightly!!) ... (actually, in those circumstances, I'd do it hourly, but that's me ... LOL)

Re: Cronjob - Restart vicidial

PostPosted: Thu Feb 27, 2014 2:14 am
by phil_discount
the server is only one of eight clusters .. no critical data. voicefiles are copied nightly to an external storage.

but the asterisk crashes are on differnet servers with differnt versions of asterisk.
so it will be nice if i can do a cronjob to restart vicidial if asterisk stops.

do u have any idea why i cant restart vicidial over a cronjob like this /etc/init.d/vicidial restart?

Re: Cronjob - Restart vicidial

PostPosted: Thu Feb 27, 2014 4:18 am
by geoff3dmg
Why not fix the problem properly and take the server out of the cluster until the hardware is fixed/replaced. If it's just a telephony server like you say, it's very easy to do.

Re: Cronjob - Restart vicidial

PostPosted: Thu Feb 27, 2014 4:46 am
by phil_discount
i said already. sometimes asterisk crashes and we dont know why.
until we solved the problem it will be nice to have a cronjob who checks asterisk and if need to restart vicidial.

i know thats not the perfect way .. but we have a crash every two weeks (13 telephony server).
but its not every time the same server .. strange.

Re: Cronjob - Restart vicidial

PostPosted: Thu Feb 27, 2014 5:18 am
by geoff3dmg
I assume you're restarting your telephony servers overnight anyway? If you are using phone aliasing a telephony server failure should not stop your agents from working either (relogin and they are good to go).

Re: Cronjob - Restart vicidial

PostPosted: Thu Feb 27, 2014 11:29 am
by williamconley
Instead of restarting "vicidial" when asterisk crashes, find the command that pushes the "start asterisk" command into the "asterisk" screen. And execute that command.

When we find a machine upon which asterisk has crashed, we issue "screen -r asterisk" which allows us to view the Astrisk screen. In that screen, if asterisk has crashed, will be a simple command prompt. In most cases, pushing the up arrow (previous command issued) provides the exact command issued to start asterisk originally.

So when you find asterisk not running, find the command that pushed that "start asterisk" command into that screen .. and issue it again. Instead of battling dahdi. Or force dadhi process to terminate before attempting to restart vicidial.

Re: Cronjob - Restart vicidial

PostPosted: Fri Feb 28, 2014 6:25 am
by mflorell
I added an auto-restart Asterisk feature to Admin -> Servers a couple months ago in svn/trunk and it seems to work very well in production.

Re: Cronjob - Restart vicidial

PostPosted: Fri Feb 28, 2014 10:18 pm
by williamconley
Yes! I forgot all about that! I've seen it but never had a client who needed it (at least not since I observed its existence ...)