Commit Graph

37 Commits

Author SHA1 Message Date
Walter Doekes 56caf5402c contrib: Let safe_asterisk script continue without /dev/tty9.
If you use the safe_asterisk script, it uses hardcoded defaults before
running configurable values from /etc/asterisk/startup.d. The hardcoded
default has TTY=9. Some containerized environments don't have such a
TTY, and safe_asterisk would stop.

The custom configuration from /etc/asterisk/startup.d/* isn't read until
after it stopped, so changing TTY in a custom config did not help.

This changeset changes safe_asterisk to continue if the TTY setting was
untouched and /dev/tty9 and /dev/vc/9 aren't found.

Change-Id: I2c7cdba549b77f418a0af4cb1227e8e6fe4148fc
2016-09-09 13:26:01 +02:00
Walter Doekes d0255c4a46 safe_asterisk: Don't automatically exceed MAXFILES value of 2^20.
On systems with lots of RAM (e.g. 24GB) /proc/sys/fs/file-max divided
by two can exceed the per-process file limit of 2^20. This patch
ensures the value is capped.

(Patch cleaned up by me.)

ASTERISK-24011 #close
Reported by: Michael Myles
Patches:
  safe_asterisk-ulimit.diff uploaded by Michael Myles (License #6626)
........

Merged revisions 424875 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 424878 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 424879 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424880 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-09 08:10:35 +00:00
Walter Doekes 3b0ad74e17 safe_asterisk: Overwrite old safe_asterisk on make install.
From now on, make install will overwrite safe_asterisk with the
latest version. You need to move any local modifications to files
inside /etc/asterisk/startup.d, if you have any.

See also commits r394939 and r397938.

ASTERISK-21965 #close
Patches:
  safe_asterisk.patch uploaded by jkister (License 6232, modified by me)
........

Merged revisions 415748 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12 07:52:59 +00:00
Walter Doekes ce733a02b4 safe_asterisk: Cleanup additions to r415132.
* Replaced a stray echo that should've been a message call in
  safe_asterisk. This replaces a conditional log message by a slightly
  different message. Please update your log parsing scripts.
* Made the $NOTIFY mail Subject more verbose by adding the machine name
  and exitstatus.

(Note that a 'make install' still won't overwrite your old safe_asterisk
if it exists. See ASTERISK-21965.)

ASTERISK-23492 #close
........

Merged revisions 415521 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 415522 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 415523 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-09 12:12:25 +00:00
Walter Doekes cfb9c8bff1 safe_asterisk: Cleanup and debian compatibility.
Cleans up the safe_asterisk script and adds the ASTSAFE_FOREGROUND
option that allows the debian asterisk init script to capture the
right pid.

* Drop the vim #modeline which wasn't used. Use test consistently
  without the odd configure xno syntax. Double quote all paths.
  General cleanup.
* Don't output message()s to the console but only to TTY if set.
* Allow TTY to be "no" as well as empty (debian compatibility with
  debian/patches/safe_asterisk-config).
* Add option to export ASTSAFE_FOREGROUND=1 from the init script
  that calls this to disable backgrounding. Debian uses a similar
  method in debian/patches/safe_asterisk-nobg).

ASTERISK-23492 #close
Review: https://reviewboard.asterisk.org/r/3574/
........

Merged revisions 415132 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 415171 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 415172 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-04 20:16:40 +00:00
Matthew Jordan 449afdd9e8 Revert r394939 due to (numerous) objections
The patch from ASTERISK-21965 was committed perhaps a bit too hastily. Walter
and Tzafrir have pointed out numerous issues with the approach and have
propsed an alternative in r/2757. Since it's not a time critical issue and
is not worth holding up the release of 12 for it, I've gone ahead and reverted
r394939 from 12/trunk and re-opened ASTERISK-21965.
........

Merged revisions 397938 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 20:22:08 +00:00
Matthew Jordan 54803338b4 Always install safe_asterisk; add configuration file support
This patch modifies the behavior of safe_asterisk in two ways:
(1) It modifies the Asterisk Makefile such that safe_asterisk is always
    installed on a 'make install'. This was done as bugfixes in the
    safe_asterisk script were not applied in previous version of Asterisk
    without first removing the old version of the script.
(2) In order to keep a newly installed version of safe_asterisk from impacting
    local modifications, a new config file - safe_asterisk.conf.sample - has
    been provided. Settings that were previously modified in safe_asterisk can
    be set there instead.

(closes issue ASTERISK-21965)
Reported by: Jeremy Kister
patches:
  safe_asterisk.patch uploaded by jkister (License 6232)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-21 18:12:00 +00:00
Matthew Jordan a3e7a77a82 Update init.d scripts to handle stderr; readd splash screen for remote consoles
When r376428 was commited to re-order start up sequences to be more tolerant of
forking with thread primitives, a few items were changed that caused changes
in behavior on some distros. This includes:
 * Not displaying the splash screen on a remote console.
 * Displaying an error message on stderr when a remote console cannot connect
   to a running instance of Asterisk.

In the first case, the splash screen was re-added (thanks to Michael L. Young).
In the second case, the various init.d scripts were modified to pipe stderr
to /dev/null, as the error message is useful - if you execute a remote
console or a remote console command execution and it fail, it should tell
you. Note that the error message was always present, it just failed to be
printed prior to r376428.

Much thanks to the folks who quickly reported this problem, provided solutions,
and promptly tested the various init.d scripts on a variety of distros.

(closes issue ASTERISK-20945)
Reported by: Warren Selby
Tested by: Michael L. Young, Jamuel Starkey, kaldemar, Danny Nicholas, mjordan
patches:
  asterisk-20945-remote-intro-msg.diff uploaded by elguero (license 5026)
  ASTERISK-20945-1.8-mjordan.diff uploaded by mjordan (license 6283)
........

Merged revisions 379760 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 379777 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 379790 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-21 20:41:12 +00:00
Matthew Nicholson 684fd12597 This adds support for setting several safe_asterisk parameters using
environment variables and also enables a custom run directory for asterisk
(instead of defaulting to /tmp).

Patch by: Byron Clark (byronclark)
(closes ASTERISK-17810)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-20 20:06:17 +00:00
Leif Madsen 87a8619e34 Merged revisions 317104 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r317104 | lmadsen | 2011-05-05 11:04:24 -0400 (Thu, 05 May 2011) | 15 lines
  
  Merged revisions 317102 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r317102 | lmadsen | 2011-05-05 10:54:46 -0400 (Thu, 05 May 2011) | 8 lines
    
    Disable console colourization inside safe_asterisk checks.
    
    (closes issue #19213)
    Reported by: lefoyer
    Patches: 
          issue19213_strip_color_in_safe_asterisk-svn.patch uploaded by wdoekes (license 717)
    Tested by: wdoekes, lefoyer
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-05 15:06:59 +00:00
David Ruggles 08e6f86d23 update safe_asterisk script
change defaults to make a little more sense. Default log location is now asterisk log location and default email notification has been changed to root on the local machine

Review: https://reviewboard.asterisk.org/r/1067/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@300761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-06 01:41:57 +00:00
Tilghman Lesher 3168cb379d Merged revisions 239307 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r239307 | tilghman | 2010-01-11 21:18:36 -0600 (Mon, 11 Jan 2010) | 8 lines
  
  Portability and other fixes for the safe_asterisk script
  (closes issue #16416)
   Reported by: bklang
   Patches: 
         safe_asterisk-compat-1.patch uploaded by bklang (license 919)
         20100106__issue16416__trunk.diff.txt uploaded by tilghman (license 14)
   Tested by: bklang
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-12 03:21:40 +00:00
Joshua Colp 02401da266 Merged revisions 196657 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r196657 | file | 2009-05-26 10:06:09 -0300 (Tue, 26 May 2009) | 7 lines
  
  Remove some bash specific stuff from safe_asterisk.
  
  (closes issue #10812)
  Reported by: paravoid
  Patches:
        safe_asterisk_bashism.diff uploaded by tzafrir (license 46)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-26 13:06:50 +00:00
Michiel van Baak 5b497da128 set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path
When running asterisk as non-root and without this patch the pidfile wants
to go into /var/run/asterisk.pid. This directory is not writable for
the non-root user and changing permissions is not an option.
Putting it in /var/run/asterisk/asterisk.pid makes it possible
to set permissions on the /var/run/asterisk dir so everything
works as it should be.

Patched committed is based on pabelanger's patch.

(closes issue #13153)
Reported by: pabelanger
Patches:
      2009012900_bug13153-nonrootscripts.diff.txt uploaded by mvanbaak (license 7)

Review: http://reviewboard.digium.com/r/139/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-21 13:13:35 +00:00
Tilghman Lesher 326653d5e8 Set up umask as a possible configuration option.
(closes issue #13753)
 Reported by: irroot


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 19:54:11 +00:00
Michiel van Baak 5797763dcf use pkill instead of killall to be more portable
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@147266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-07 18:00:48 +00:00
Michiel van Baak d1df7bfcfc Make safe_asterisk work on dash/sh/bash etc.
(closes issue #13111)
Reported by: pabelanger
Patches:
      2008071901_issue13111_safe_asterisk.diff uploaded by mvanbaak (license 7)
Tested by: mvanbaak, pabelanger


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-01 12:17:33 +00:00
Michiel van Baak fcc15d65b1 Merged revisions 119301 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r119301 | mvanbaak | 2008-05-30 18:44:39 +0200 (Fri, 30 May 2008) | 14 lines

dont use a bashism way to check the $VERSION variable.
The rc/init.d scripts, and safe_asterisk work on normal sh now again.
Tested on:
OpenBSD 4.2 (me)
Debian etch (me)
Ubuntu Hardy (me and loloski)
FC9 (loloski)

(closes issue #12687)
Reported by: loloski
Patches:
      20080529-12687-safe_asterisk-fixversion.diff.txt uploaded by mvanbaak (license 7)
	  Tested by: loloski, mvanbaak

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-30 16:47:24 +00:00
Tilghman Lesher e01ada1ca7 Merged revisions 115285 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115285 | tilghman | 2008-05-04 22:22:25 -0500 (Sun, 04 May 2008) | 7 lines

When starting Asterisk, bug out if Asterisk is already running.
(closes issue #12525)
 Reported by: explidous
 Patches: 
       20080428__bug12525.diff.txt uploaded by Corydon76 (license 14)
 Tested by: mvanbaak

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-05 03:25:35 +00:00
Russell Bryant 922de69e41 Merged revisions 83316 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83316 | russell | 2007-09-20 16:01:20 -0500 (Thu, 20 Sep 2007) | 3 lines

Change safe_asterisk to explicitly ask for /bin/bash, as it uses bashisms.
(closes issue #10772, reported by culrich)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-20 21:02:17 +00:00
Tilghman Lesher cd9c418200 Incorporate the ability to log output of safe_asterisk to syslog (closes issue #9882)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81744 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-06 16:57:20 +00:00
Tilghman Lesher 3d6db3c4af Merged revisions 69744 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r69744 | tilghman | 2007-06-18 12:46:40 -0500 (Mon, 18 Jun 2007) | 10 lines

Merged revisions 69743 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r69743 | tilghman | 2007-06-18 12:45:15 -0500 (Mon, 18 Jun 2007) | 2 lines

Issue 9998 - Remove SIG prefix, since it's not supported by ksh

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-18 17:50:01 +00:00
Tilghman Lesher a4f5985b8c Merged revisions 63905 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r63905 | tilghman | 2007-05-11 11:35:51 -0500 (Fri, 11 May 2007) | 10 lines

Merged revisions 63903 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r63903 | tilghman | 2007-05-11 11:31:03 -0500 (Fri, 11 May 2007) | 2 lines

Issue 9121 - fixups for safe_asterisk script

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-11 16:37:16 +00:00
Russell Bryant 9301bbd3ab add the ability to run an arbitrary command if asterisk crashes
(inspired by issue #7698, which was res_segfault by anthm)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@39636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-14 01:13:32 +00:00
Kevin P. Fleming 2af019970f Merged revisions 21638 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r21638 | kpfleming | 2006-04-19 16:10:41 -0500 (Wed, 19 Apr 2006) | 2 lines

support system-specific scripts in safe_asterisk, before starting Asterisk proper

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-19 21:11:31 +00:00
Matthew Fredrickson 3e73dcfa2c Make sure safe_asterisk retains previous script defaults
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-24 22:06:37 +00:00
Matthew Fredrickson 1bb29aa0cd Updates from royk to safe_asterisk (#5207) Thanks!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-24 21:45:42 +00:00
Kevin P. Fleming 2c65582b66 remove extraneous svn:executable properties
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29 18:24:39 +00:00
Mark Spencer 079b24c53c Build safe_asterisk script substituting the proper path in (bug #4952, patch not used)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-14 02:19:16 +00:00
Mark Spencer 50da413b63 Specify hostname if there is a crash (bug #2958)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-12-01 05:10:32 +00:00
Mark Spencer eb718e597d Let safe_asterisk take arguments (bug #2085)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-07-25 23:12:33 +00:00
Mark Spencer 3a2f0750cb Fix safe_asterisk script
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2004-03-12 20:20:36 +00:00
Mark Spencer f6f32e60d5 Add debugging to safe_asterisk
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@972 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2003-05-07 22:33:55 +00:00
Matteo Brancaleoni cf3b725fe9 mar feb 18 19:15:15 CET 2003
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@618 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2003-02-18 18:15:30 +00:00
Mark Spencer 775de47268 Version 0.3.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2002-10-08 17:14:31 +00:00
Mark Spencer e86dd9ef2e Version 0.2.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2002-07-30 14:17:55 +00:00
Mark Spencer 44ec0d02a2 Version 0.1.12 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2002-05-27 23:15:47 +00:00