aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/scripts/safe_asterisk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/scripts/safe_asterisk')
-rw-r--r--contrib/scripts/safe_asterisk8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/scripts/safe_asterisk b/contrib/scripts/safe_asterisk
index 05e44d895..e73933ad4 100644
--- a/contrib/scripts/safe_asterisk
+++ b/contrib/scripts/safe_asterisk
@@ -38,6 +38,14 @@ function message() {
fi
}
+# Check if Asterisk is already running. If it is, then bug out, because
+# starting safe_asterisk when Asterisk is running is very bad.
+VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+ message "Asterisk is already running. $0 will exit now."
+ exit 1
+fi
+
# since we're going to change priority and open files limits, we need to be
# root. if running asterisk as other users, pass that to asterisk on the command
# line.