I'm running * 1.4 and can successfully restart asterisk from the command line with: /usr/sbin/asterisk -r -x "restart gracefully" However, I have a cron job that tries to restart asterisk and gets this error: No such command 'restart gracefully' (type 'help restart gracefully' for other possible commands) Can anyone think of why this is happening? Thanks
On Wed, Dec 9, 2009 at 3:08 PM, Michelle Dupuis <support at ocg.ca> wrote:> I'm running * 1.4 and can successfully restart asterisk from the command > line with: > /usr/sbin/asterisk -r -x "restart gracefully" > > However, I have a cron job that tries to restart asterisk and gets this > error: > No such command 'restart gracefully' (type 'help restart gracefully' for > other possible commands) > > Can anyone think of why this is happening? > > Thanks >Maybe you need to escape your quotes (\"restart gracefully\") in your script? Just a thought... -- Thanks, --Warren Selby http://www.selbytech.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20091209/67c995a7/attachment.htm
Juan E. RodrÃguez
2009-Dec-10 03:13 UTC
[asterisk-users] Can't restart asterisk from script
You should replace the single quote with double quote. ------Original Message------ From: Michelle Dupuis Sender: asterisk-users-bounces at lists.digium.com To: 'Asterisk Users List' ReplyTo: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Can't restart asterisk from script Sent: Dec 9, 2009 10:59 PM But the error message in my log shows the error to be from asterisk, so I'm guessing I'm sending a parameter incorrectly to asterisk - which fits with the no quote theory -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Bill Kenworthy Sent: Wednesday, December 09, 2009 9:31 PM To: Asterisk Users List Subject: Re: [asterisk-users] Can't restart asterisk from script Keep in mond that cron usually has a very abbreviated environment for security reasons - you may need to set the PATH or other environment variables in the crontab to get it to work. Billk On Wed, 2009-12-09 at 20:55 -0500, Michelle Dupuis wrote:> Interesting...I'll try that. Thanks > > > ______________________________________________________________________ > From: asterisk-users-bounces at lists.digium.com > [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Lyle > Giese > Sent: Wednesday, December 09, 2009 8:47 PM > To: Asterisk Users List > Subject: Re: [asterisk-users] Can't restart asterisk from script > > > > Doug Lytle wrote: > > Warren Selby wrote: > > > > > On Wed, Dec 9, 2009 at 3:08 PM, Michelle Dupuis <support at ocg.ca > > > <mailto:support at ocg.ca>> wrote: > > > > > > I'm running * 1.4 and can successfully restart asterisk from the > > > command > > > line with: > > > /usr/sbin/asterisk -r -x "restart gracefully" > > > > > > > > > > I have the following cron job: > > > > /usr/sbin/asterisk -r -x 'restart when convenient' > > > > Doug > > > > > You probably don't need the single or double quotes at all. I have > never used any quoting in crontab. > > Lyle Giese > LCR Computer Services, Inc. > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users_______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Saludos, Juan E. Rodr?guez
On Wed, 9 Dec 2009, Michelle Dupuis wrote:> I'm running * 1.4 and can successfully restart asterisk from the command > line with: /usr/sbin/asterisk -r -x "restart gracefully" > > However, I have a cron job that tries to restart asterisk and gets this > error: > > No such command 'restart gracefully' (type 'help restart gracefully' for > other possible commands)By "cron job" do you mean an entry in <the-user-executing-asterisk>'s crontab like one of the following? @daily /usr/sbin/asterisk -r -x "restart gracefully" @daily /usr/sbin/asterisk -r -x 'restart gracefully' @daily /usr/sbin/asterisk -r -x restart gracefully @daily /scripts/restart-when-convenient.sh The first 2 work, the 3rd doesn't. If you are using something like the 4th, the error is in your script so you should post the script. The difference between the first 2 is that 1 uses double quotes and 2 uses single quotes. Quotes mean "pass everything between the quotes as a single argument." Double quotes mean "evaluate any expressions or environment variables before passing." Single quotes mean "pass everything literally, without evaluation or substitution." Single quotes are "better" than double quotes because we already know there is nothing to evaluate or substitute in "restart gracefully" so there is no need to pass the quoted string through the evaluation/substitution code in the shell. The 3rd doesn't work because just "restart" is passed as the argument to the "x" option and "restart" by itself is not a valid Asterisk command. Please paste your crontab if you still need help. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
2009/12/9 Michelle Dupuis <support at ocg.ca>> I'm running * 1.4 and can successfully restart asterisk from the command > line with: > /usr/sbin/asterisk -r -x "restart gracefully" > > However, I have a cron job that tries to restart asterisk and gets this > error: > No such command 'restart gracefully' (type 'help restart gracefully' for > other possible commands) > > Can anyone think of why this is happening? > >I've met a situation where a call remained active tough obviously, no one was talking to anyone. This kept gracefully restart from working. So, would a 'restart now' behave differently ?> Thanks > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > 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/20091210/6fae7eab/attachment.htm
On Wed, 9 Dec 2009, Michelle Dupuis wrote:> However, I have a cron job that tries to restart asterisk and gets this > error:> No such command 'restart gracefully' (type 'help restart gracefully' for > other possible commands)Did you find a solution -- inquiring minds want to know... -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000