[asterisk-commits] contrib: Let safe asterisk script continue without /dev/tty9. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 12 09:03:48 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: contrib: Let safe_asterisk script continue without /dev/tty9.
......................................................................


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
---
M contrib/scripts/safe_asterisk
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve



diff --git a/contrib/scripts/safe_asterisk b/contrib/scripts/safe_asterisk
index 62f3dad..66213a5 100644
--- a/contrib/scripts/safe_asterisk
+++ b/contrib/scripts/safe_asterisk
@@ -120,13 +120,20 @@
 		TTY=tty${TTY}
 	elif test -c /dev/vc/${TTY}; then
 		TTY=vc/${TTY}
+	elif test "$TTY" = "9"; then  # ignore default if it was untouched
+		# If there is no /dev/tty9 and not /dev/vc/9 we don't
+		# necessarily want to die at this point. Pretend that
+		# TTY wasn't set.
+		TTY=
 	else
 		message "Cannot find specified TTY (${TTY})"
 		exit 1
 	fi
-	ASTARGS="${ASTARGS} -vvvg"
-	if test "$CONSOLE" != "no"; then
-		ASTARGS="${ASTARGS} -c"
+	if test -n "$TTY"; then
+		ASTARGS="${ASTARGS} -vvvg"
+		if test "$CONSOLE" != "no"; then
+			ASTARGS="${ASTARGS} -c"
+		fi
 	fi
 fi
 

-- 
To view, visit https://gerrit.asterisk.org/3869
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c7cdba549b77f418a0af4cb1227e8e6fe4148fc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list