Summary: | ASTERISK-05004: [patch] [post 1.2] safe asterisk restart script to be used by unix illiterates | ||
Reporter: | Roy Sigurd Karlsbakk (rkarlsba) | Labels: | |
Date Opened: | 2005-09-06 05:19:41 | Date Closed: | 2008-01-15 16:11:25.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) yesyesreallyrestartasterisknow ( 1) yesyesreallyrestartasterisknow-2005-09-11 | |
Description: | i wrote this little shell script to allow unix illiterates to restart asterisk if something is really bad and none of the unix literates are around. the script checks if it's root, prompts the user three times, does a countdown from 5, stops asterisk, kills asterisk and kills asterisk a little more, runs safe_asterisk and lists asterisk processes. roy | ||
Comments: | By: Clod Patry (junky) 2005-09-06 09:25:00 prompt "Are you sure you want to restart asterisk? (yes/no)? " "yes" prompt "Really sure? (yes/no)? " "yes" prompt "Absolutely positive? (YES/no)? " "YES" i think there's no need to ask 3 times the same question plus a countdown. By: Serge Vecher (serge-v) 2005-09-06 09:29:22 What is the reason/value of the following? # please remove the following line to allow this script to really restart # asterisk # die "i'm a coward"; By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-06 09:31:16 junky: i'm talking about allowing my boss into the system, so i'd rather be sure he knows what he's doing, but you have a point, i'll give you that. perhaps two prompts and a countdown? or just one? venchers: i used that while first debugging the script. that can be removed. sorry. roy By: Tilghman Lesher (tilghman) 2005-09-06 18:38:48 There's a much better way to check if Asterisk has shut down yet or not: pidof asterisk | awk '{print NF}' will output the number of processes that are still running that are called 'asterisk'. You can use this to find out whether or not your shutdown has succeeded yet. This allows you to avoid sending termination and kill signals to the Asterisk process, especially given that it may take a few moments for Asterisk to safely shut down. By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-06 18:43:05 sure, but i still want to kill the mpg123 procs and the old AGI procs ifany are remaining this is brute force, and that is why i wrote it roy By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-07 04:50:53 i'll change this to using pidof. i agree it's better.. By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-08 14:11:56 hm pidof does not work with complex command lines it only work with the exact commandline, as in 'perl ...' i really don't want to kill all perl scripts on the box while restarting asterisk there might be something useful running there as well perhaps killall will do the job better than kill `pidof something`? roy By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-10 04:35:49 IMHO, this script does the job. Any more comments? By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-11 04:07:06 new version added with args to avoid potential hangs (don't asterisk -rx 'restart now'), avoid prompts and run without countdown By: Kevin P. Fleming (kpfleming) 2006-01-03 13:33:55.000-0600 Committed to SVN trunk with minor modifications, thanks! By: Digium Subversion (svnbot) 2008-01-15 16:10:49.000-0600 Repository: asterisk Revision: 7748 A trunk/contrib/scripts/safe_asterisk_restart ------------------------------------------------------------------------ r7748 | kpfleming | 2008-01-15 16:10:49 -0600 (Tue, 15 Jan 2008) | 2 lines add script for simple 'no-brainer' restarts of safe_asterisk (issue ASTERISK-5004) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7748 By: Digium Subversion (svnbot) 2008-01-15 16:11:19.000-0600 Repository: asterisk Revision: 7781 _U team/oej/aum-trunk/ U team/oej/aum-trunk/UPGRADE.txt U team/oej/aum-trunk/apps/app_chanspy.c U team/oej/aum-trunk/apps/app_mixmonitor.c U team/oej/aum-trunk/apps/app_privacy.c U team/oej/aum-trunk/apps/app_stack.c D team/oej/aum-trunk/ast_expr.y U team/oej/aum-trunk/ast_expr2.fl U team/oej/aum-trunk/ast_expr2f.c U team/oej/aum-trunk/autoservice.c U team/oej/aum-trunk/cdr.c U team/oej/aum-trunk/channel.c U team/oej/aum-trunk/channels/chan_iax2.c U team/oej/aum-trunk/channels/chan_sip.c U team/oej/aum-trunk/configs/manager.conf.sample U team/oej/aum-trunk/configs/sip.conf.sample A team/oej/aum-trunk/contrib/scripts/safe_asterisk_restart U team/oej/aum-trunk/file.c U team/oej/aum-trunk/funcs/func_moh.c U team/oej/aum-trunk/image.c U team/oej/aum-trunk/include/asterisk/chanspy.h U team/oej/aum-trunk/include/asterisk/image.h U team/oej/aum-trunk/include/asterisk/rtp.h U team/oej/aum-trunk/manager.c U team/oej/aum-trunk/pbx.c U team/oej/aum-trunk/res/Makefile U team/oej/aum-trunk/res/res_osp.c U team/oej/aum-trunk/rtp.c ------------------------------------------------------------------------ r7781 | oej | 2008-01-15 16:11:18 -0600 (Tue, 15 Jan 2008) | 171 lines Merged revisions 7720,7725,7728-7734,7737,7739,7741,7744-7745,7747-7748,7750-7751,7770,7774-7779 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r7720 | russell | 2006-01-02 19:54:34 +0100 (Mon, 02 Jan 2006) | 2 lines doxygen updates ................ r7725 | russell | 2006-01-03 00:52:33 +0100 (Tue, 03 Jan 2006) | 2 lines initialize sip_auth list ................ r7728 | oej | 2006-01-03 09:40:55 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5960: Clean up list handling in image.c (drumkilla) ................ r7729 | oej | 2006-01-03 09:54:19 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5958: Use list macros in autoservice.c (drumkilla) ................ r7730 | oej | 2006-01-03 10:30:19 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5951: Fix unprotected list in RTP, implement AST_LIST macros, update doxygen docs ................ r7731 | oej | 2006-01-03 12:21:48 +0100 (Tue, 03 Jan 2006) | 2 lines Bug 5345; Add configuration option for minimum registration time. (folsson) ................ r7732 | oej | 2006-01-03 12:31:56 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5088: Add caller ID and CallerIDname to OriginateSuccess/Failure manager events (outtolunc) ................ r7733 | oej | 2006-01-03 12:58:10 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5913: Broken rport match in check_via(). (rizzo) ................ r7734 | oej | 2006-01-03 13:25:32 +0100 (Tue, 03 Jan 2006) | 2 lines Issue ASTERISK-5799: Implement printf-like append_history and implement AST_LIST for SIP history (rizzo) ................ r7737 | kpfleming | 2006-01-03 17:39:37 +0100 (Tue, 03 Jan 2006) | 10 lines Merged revisions 7736 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7736 | kpfleming | 2006-01-03 10:34:12 -0600 (Tue, 03 Jan 2006) | 2 lines don't leak memory for (most) expression evaluations ........ ................ r7739 | kpfleming | 2006-01-03 18:08:35 +0100 (Tue, 03 Jan 2006) | 3 lines fix breakage from rev 7730 (failure to unlock list in get_proto) minor cleanups and simpler usage of list macros ................ r7741 | kpfleming | 2006-01-03 18:25:39 +0100 (Tue, 03 Jan 2006) | 12 lines Merged revisions 7740 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7740 | kpfleming | 2006-01-03 11:24:56 -0600 (Tue, 03 Jan 2006) | 4 lines revert incorrect fix for bug ASTERISK-5890 from revision 7709 put in correct (simpler) fix add doxygen docs for channel spy 'state' values ........ ................ r7744 | tilghman | 2006-01-03 19:17:42 +0100 (Tue, 03 Jan 2006) | 3 lines Merged revisions 7743 via svnmerge from /branches/1.2 ................ r7745 | oej | 2006-01-03 20:12:50 +0100 (Tue, 03 Jan 2006) | 2 lines Don't check user call limits for outbound calls. ................ r7747 | kpfleming | 2006-01-03 21:23:23 +0100 (Tue, 03 Jan 2006) | 10 lines Merged revisions 7746 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7746 | kpfleming | 2006-01-03 14:22:18 -0600 (Tue, 03 Jan 2006) | 2 lines remove unused 'old' expression parser ........ ................ r7748 | kpfleming | 2006-01-03 21:33:28 +0100 (Tue, 03 Jan 2006) | 2 lines add script for simple 'no-brainer' restarts of safe_asterisk (issue ASTERISK-5004) ................ r7750 | kpfleming | 2006-01-03 23:07:12 +0100 (Tue, 03 Jan 2006) | 2 lines add optional timestamps to manager events (issue ASTERISK-5387, simplified) ................ r7751 | kpfleming | 2006-01-03 23:16:23 +0100 (Tue, 03 Jan 2006) | 2 lines update copyright headers for files changed this year ................ r7770 | bweschke | 2006-01-04 06:26:03 +0100 (Wed, 04 Jan 2006) | 3 lines Fix the 'if' clause to be true under the right conditions. Bug ASTERISK-5969 ................ r7774 | russell | 2006-01-04 08:08:08 +0100 (Wed, 04 Jan 2006) | 10 lines Merged revisions 7773 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7773 | russell | 2006-01-04 02:06:50 -0500 (Wed, 04 Jan 2006) | 2 lines use a more correct way of determining the size of the destination buffer ........ ................ r7775 | oej | 2006-01-04 10:10:56 +0100 (Wed, 04 Jan 2006) | 6 lines - Remove "incominglimit" as a configuration option in sip.conf - Add documentation on call-limit, explaining that there's two counters for a type="friend". - Document the removval of "incominglimit" in UPGRADE.txt ................ r7776 | oej | 2006-01-04 10:22:45 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5970: Count in show channeltypes (junky) ................ r7777 | oej | 2006-01-04 11:16:53 +0100 (Wed, 04 Jan 2006) | 2 lines Missing ">" in XML. Thanks, fenlander, for reporting this on IRC. ................ r7778 | russell | 2006-01-04 13:11:11 +0100 (Wed, 04 Jan 2006) | 2 lines doxygen tweak ................ r7779 | oej | 2006-01-04 13:16:30 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5797: Add destination protocol information to res_osp (homesick) ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7781 By: Digium Subversion (svnbot) 2008-01-15 16:11:25.000-0600 Repository: asterisk Revision: 7787 _U team/oej/multiparking/ U team/oej/multiparking/UPGRADE.txt U team/oej/multiparking/apps/app_chanspy.c U team/oej/multiparking/apps/app_disa.c U team/oej/multiparking/apps/app_mixmonitor.c U team/oej/multiparking/apps/app_privacy.c U team/oej/multiparking/apps/app_stack.c D team/oej/multiparking/ast_expr.y U team/oej/multiparking/ast_expr2.fl U team/oej/multiparking/ast_expr2f.c U team/oej/multiparking/autoservice.c U team/oej/multiparking/cdr.c U team/oej/multiparking/channel.c U team/oej/multiparking/channels/chan_iax2.c U team/oej/multiparking/channels/chan_sip.c U team/oej/multiparking/channels/chan_zap.c U team/oej/multiparking/configs/manager.conf.sample U team/oej/multiparking/configs/sip.conf.sample U team/oej/multiparking/contrib/scripts/managerproxy.pl A team/oej/multiparking/contrib/scripts/safe_asterisk_restart U team/oej/multiparking/file.c U team/oej/multiparking/funcs/func_moh.c U team/oej/multiparking/image.c U team/oej/multiparking/include/asterisk/chanspy.h U team/oej/multiparking/include/asterisk/image.h U team/oej/multiparking/include/asterisk/rtp.h U team/oej/multiparking/manager.c U team/oej/multiparking/pbx.c U team/oej/multiparking/res/res_osp.c U team/oej/multiparking/rtp.c ------------------------------------------------------------------------ r7787 | oej | 2008-01-15 16:11:24 -0600 (Tue, 15 Jan 2008) | 186 lines Merged revisions 7725,7728-7734,7737,7739,7741,7744-7745,7747-7748,7750-7751,7770,7774-7779,7783-7786 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r7725 | russell | 2006-01-03 00:52:33 +0100 (Tue, 03 Jan 2006) | 2 lines initialize sip_auth list ................ r7728 | oej | 2006-01-03 09:40:55 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5960: Clean up list handling in image.c (drumkilla) ................ r7729 | oej | 2006-01-03 09:54:19 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5958: Use list macros in autoservice.c (drumkilla) ................ r7730 | oej | 2006-01-03 10:30:19 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5951: Fix unprotected list in RTP, implement AST_LIST macros, update doxygen docs ................ r7731 | oej | 2006-01-03 12:21:48 +0100 (Tue, 03 Jan 2006) | 2 lines Bug 5345; Add configuration option for minimum registration time. (folsson) ................ r7732 | oej | 2006-01-03 12:31:56 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5088: Add caller ID and CallerIDname to OriginateSuccess/Failure manager events (outtolunc) ................ r7733 | oej | 2006-01-03 12:58:10 +0100 (Tue, 03 Jan 2006) | 2 lines Bug ASTERISK-5913: Broken rport match in check_via(). (rizzo) ................ r7734 | oej | 2006-01-03 13:25:32 +0100 (Tue, 03 Jan 2006) | 2 lines Issue ASTERISK-5799: Implement printf-like append_history and implement AST_LIST for SIP history (rizzo) ................ r7737 | kpfleming | 2006-01-03 17:39:37 +0100 (Tue, 03 Jan 2006) | 10 lines Merged revisions 7736 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7736 | kpfleming | 2006-01-03 10:34:12 -0600 (Tue, 03 Jan 2006) | 2 lines don't leak memory for (most) expression evaluations ........ ................ r7739 | kpfleming | 2006-01-03 18:08:35 +0100 (Tue, 03 Jan 2006) | 3 lines fix breakage from rev 7730 (failure to unlock list in get_proto) minor cleanups and simpler usage of list macros ................ r7741 | kpfleming | 2006-01-03 18:25:39 +0100 (Tue, 03 Jan 2006) | 12 lines Merged revisions 7740 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7740 | kpfleming | 2006-01-03 11:24:56 -0600 (Tue, 03 Jan 2006) | 4 lines revert incorrect fix for bug ASTERISK-5890 from revision 7709 put in correct (simpler) fix add doxygen docs for channel spy 'state' values ........ ................ r7744 | tilghman | 2006-01-03 19:17:42 +0100 (Tue, 03 Jan 2006) | 3 lines Merged revisions 7743 via svnmerge from /branches/1.2 ................ r7745 | oej | 2006-01-03 20:12:50 +0100 (Tue, 03 Jan 2006) | 2 lines Don't check user call limits for outbound calls. ................ r7747 | kpfleming | 2006-01-03 21:23:23 +0100 (Tue, 03 Jan 2006) | 10 lines Merged revisions 7746 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7746 | kpfleming | 2006-01-03 14:22:18 -0600 (Tue, 03 Jan 2006) | 2 lines remove unused 'old' expression parser ........ ................ r7748 | kpfleming | 2006-01-03 21:33:28 +0100 (Tue, 03 Jan 2006) | 2 lines add script for simple 'no-brainer' restarts of safe_asterisk (issue ASTERISK-5004) ................ r7750 | kpfleming | 2006-01-03 23:07:12 +0100 (Tue, 03 Jan 2006) | 2 lines add optional timestamps to manager events (issue ASTERISK-5387, simplified) ................ r7751 | kpfleming | 2006-01-03 23:16:23 +0100 (Tue, 03 Jan 2006) | 2 lines update copyright headers for files changed this year ................ r7770 | bweschke | 2006-01-04 06:26:03 +0100 (Wed, 04 Jan 2006) | 3 lines Fix the 'if' clause to be true under the right conditions. Bug ASTERISK-5969 ................ r7774 | russell | 2006-01-04 08:08:08 +0100 (Wed, 04 Jan 2006) | 10 lines Merged revisions 7773 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7773 | russell | 2006-01-04 02:06:50 -0500 (Wed, 04 Jan 2006) | 2 lines use a more correct way of determining the size of the destination buffer ........ ................ r7775 | oej | 2006-01-04 10:10:56 +0100 (Wed, 04 Jan 2006) | 6 lines - Remove "incominglimit" as a configuration option in sip.conf - Add documentation on call-limit, explaining that there's two counters for a type="friend". - Document the removval of "incominglimit" in UPGRADE.txt ................ r7776 | oej | 2006-01-04 10:22:45 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5970: Count in show channeltypes (junky) ................ r7777 | oej | 2006-01-04 11:16:53 +0100 (Wed, 04 Jan 2006) | 2 lines Missing ">" in XML. Thanks, fenlander, for reporting this on IRC. ................ r7778 | russell | 2006-01-04 13:11:11 +0100 (Wed, 04 Jan 2006) | 2 lines doxygen tweak ................ r7779 | oej | 2006-01-04 13:16:30 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5797: Add destination protocol information to res_osp (homesick) ................ r7783 | oej | 2006-01-04 14:07:34 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5673: Adding more SIP to ISDN Cause code conversions. Thanks mguesdon! ................ r7784 | oej | 2006-01-04 14:49:25 +0100 (Wed, 04 Jan 2006) | 2 lines Whitespace and formatting changes. /Housekeeping ................ r7785 | oej | 2006-01-04 14:56:11 +0100 (Wed, 04 Jan 2006) | 2 lines Small typo fix ................ r7786 | mattf | 2006-01-04 15:46:41 +0100 (Wed, 04 Jan 2006) | 2 lines Fixes for bug ASTERISK-5968 ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7787 |