Amine Mrichcha
2010-Mar-24 16:02 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
Hi All, I do have asterisk installed for a call center and I would like to know if it is possible to create a scipt and execute it from a PC connected to the Network without accessing the server. This script should restart asterisk and another service related to aheeva. The problem now is that each time I have to access using PUTY to the server to start and run services manually. Service asterisk restart Any help would be appreciated, sorry if it is a newbie question. Regards, Am -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100324/dd0daf94/attachment.htm
Steve Edwards
2010-Mar-24 16:11 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
On Wed, 24 Mar 2010, Amine Mrichcha wrote:> I do have asterisk installed for a call center and I would like to know > if it is possible to create a scipt and execute it from a PC connected > to the Network without accessing the server. This script should restart > asterisk and another service related to aheeva. > > The problem now is that each time I have to access using PUTY to the > server to start and run services manually. > > Service asterisk restart > > Any help would be appreciated, sorry if it is a newbie question.Why do you need to restart Asterisk? Is it crashing (in which case you should fix the underlying cause, not just put a band-aid over it) or is it not starting when the system is started? If you are not going to access the server, what event is going to trigger the execution of your script? -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
Jose P. Espinal
2010-Mar-24 16:22 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
Hi there, a. You could (maybe) use PHP and send some command via POST, and (after secure/validating the command) use 'exec()' function in php, or 'system()' function. Note: that would require to have a webserver with php installed on it. And allowing the user under which the webserver runs, to restart asterisk via sudoers file. b. You could use a shellscript that sends the command via SSH. In order to avoid password prompt, you could generate a RSA (or DSA) key pair on the machine that will send the command, and copy the rsa_key.pub content on your asterisk box 'authorized_keys'. That would allow you to execute the command remotely via SSH without having to insert the password manually. Note: you could consider using a very limited user on the asterisk box, and with sudoers file allowing it just to restart Asterisk. Regards, Amine Mrichcha wrote:> Hi All, > > I do have asterisk installed for a call center and I would like to know > if it is possible to create a scipt and execute it from a PC connected > to the Network without accessing the server. This script should restart > asterisk and another service related to aheeva. > > The problem now is that each time I have to access using PUTY to the > server to start and run services manually. > > Service asterisk restart > > Any help would be appreciated, sorry if it is a newbie question. > > Regards, > > Am >-- Jose P. Espinal http://www.eSlackware.com IRC: Khratos @ #asterisk / -doc / -bugs
Amine Mrichcha
2010-Mar-24 16:24 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
Hi Steve, Thanks. Yes it is crashing but as a workaround we restart it and we are investigating about the root cause. My question was if it is possible to create a patch script or somthing like this that we can launch from a PC without directly access the server. Regards, On Wed, Mar 24, 2010 at 5:11 PM, Steve Edwards <asterisk.org at sedwards.com>wrote:> On Wed, 24 Mar 2010, Amine Mrichcha wrote: > > > I do have asterisk installed for a call center and I would like to know > > if it is possible to create a scipt and execute it from a PC connected > > to the Network without accessing the server. This script should restart > > asterisk and another service related to aheeva. > > > > The problem now is that each time I have to access using PUTY to the > > server to start and run services manually. > > > > Service asterisk restart > > > > Any help would be appreciated, sorry if it is a newbie question. > > Why do you need to restart Asterisk? Is it crashing (in which case you > should fix the underlying cause, not just put a band-aid over it) or is it > not starting when the system is started? > > If you are not going to access the server, what event is going to trigger > the execution of your script? > > -- > Thanks in advance, > ------------------------------------------------------------------------- > Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST > Newline Fax: +1-760-731-3000 > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100324/a01ec42b/attachment-0001.htm
Jose P. Espinal
2010-Mar-24 16:37 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
Hi, Have you tested safe_asterisk ? Amine Mrichcha wrote:> Hi Steve, > > Thanks. Yes it is crashing but as a workaround we restart it and we are > investigating about the root cause. > > My question was if it is possible to create a patch script or somthing > like this that we can launch from a PC without directly access the server. > > Regards, > > On Wed, Mar 24, 2010 at 5:11 PM, Steve Edwards <asterisk.org > <http://asterisk.org>@sedwards.com <http://sedwards.com>> wrote: > > On Wed, 24 Mar 2010, Amine Mrichcha wrote: > > > I do have asterisk installed for a call center and I would like > to know > > if it is possible to create a scipt and execute it from a PC > connected > > to the Network without accessing the server. This script should > restart > > asterisk and another service related to aheeva. > > > > The problem now is that each time I have to access using PUTY to the > > server to start and run services manually. > > > > Service asterisk restart > > > > Any help would be appreciated, sorry if it is a newbie question. > > Why do you need to restart Asterisk? Is it crashing (in which case you > should fix the underlying cause, not just put a band-aid over it) or > is it > not starting when the system is started? > > If you are not going to access the server, what event is going to > trigger > the execution of your script? > > -- > Thanks in advance, > ------------------------------------------------------------------------- > Steve Edwards sedwards at sedwards.com > <mailto:sedwards at sedwards.com> Voice: +1-760-468-3867 PST > Newline Fax: > +1-760-731-3000 > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com > <http://www.api-digital.com/> -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > >-- Jose P. Espinal http://www.eSlackware.com IRC: Khratos @ #asterisk / -doc / -bugs
Steve Edwards
2010-Mar-24 16:38 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
On Wed, 24 Mar 2010, Amine Mrichcha wrote:> Thanks. Yes it is crashing but as a workaround we restart it and we are > investigating about the root cause. ? My question was if it is possible > to create a patch script or somthing like this that?we can launch from?a > PC without directly access the server.The "safe_asterisk" script (which usually lives at /usr/sbin/safe_asterisk) can be a useful band-aid or "safety-net." -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
Aurimas Skirgaila
2010-Mar-29 07:36 UTC
[asterisk-users] Restarting Asterisk using a script - Thanks to all -
Hi, 1) It would be nice to find out the root reason that forces you to restart the Asterisk. I do run Aheeva with decently high uptimes. 2) Both "a" and "b" methods of Jose P. Espinal are functional, but if I'm having a failure, I up to grab the putty and investigate what's going on there :) How often are you having them? 3) what's the another service related to Aheeva, that requires to be restarted?> > Hi there,a. You could (maybe) use PHP and send some command via POST, and (after secure/validating the command) use 'exec()' function in php, or 'system()' function. Note: that would require to have a webserver with php installed on it. And allowing the user under which the webserver runs, to restart asterisk via sudoers file. b. You could use a shellscript that sends the command via SSH. In order to avoid password prompt, you could generate a RSA (or DSA) key pair on the machine that will send the command, and copy the rsa_key.pub content on your asterisk box 'authorized_keys'. That would allow you to execute the command remotely via SSH without having to insert the password manually. Note: you could consider using a very limited user on the asterisk box, and with sudoers file allowing it just to restart Asterisk. Regards, Amine Mrichcha wrote:> Hi All,>> I do have asterisk installed for a call center and I would like to know> if it is possible to create a scipt and execute it from a PC connected> to the Network without accessing the server. This script should restart> asterisk and another service related to aheeva.>> The problem now is that each time I have to access using PUTY to the> server to start and run services manually.>> Service asterisk restart>> Any help would be appreciated, sorry if it is a newbie question.>> Regards,>> Am>-- Jose P. Espinal http://www.eSlackware.com <http://www.eslackware.com/> IRC: Khratos @ #asterisk / -doc / -bugs -- Mvh, Aurimas Skirgaila -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100329/6816314e/attachment.htm