[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jun 14 09:18:43 CDT 2011


branch "review" has been updated
       via  0c78d2ab1c21a023ddbb6e334f8231ba5860915d (commit)
       via  637e926f3308b99770aa23ce7cf2bb516de9cf8f (commit)
      from  81f926a751bcce3087a207ddd586412df02a8948 (commit)

Summary of changes:
 Makefile                               |   35 +++++++----
 contrib/ubuntu/init.d/testsuite-remote |  100 ++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+), 13 deletions(-)
 create mode 100755 contrib/ubuntu/init.d/testsuite-remote


- Log -----------------------------------------------------------------
commit 0c78d2ab1c21a023ddbb6e334f8231ba5860915d
Author: Darren Sessions <dsessions at digium.com>
Date:   Tue Jun 14 09:18:38 2011 -0500

    Finally . . and init script for Ubuntu so I dont have to manually log into each of the remote hosts every time I need to start them up.

diff --git a/contrib/ubuntu/init.d/testsuite-remote b/contrib/ubuntu/init.d/testsuite-remote
new file mode 100755
index 0000000..9d8948e
--- /dev/null
+++ b/contrib/ubuntu/init.d/testsuite-remote
@@ -0,0 +1,100 @@
+#!/bin/sh
+#
+#   Test-Suite Remote Agent Init Script for Ubuntu
+#
+#   Copyright (C) 2011, Digium, Inc.
+#
+#   This program is free software, distributed under the terms of
+#   the GNU General Public License Version 2.
+#
+
+### BEGIN INIT INFO
+# Provides:         testsuite-remote
+# Required-Start:   $local_fs $remote_fs $network $syslog
+# Required-Stop:    $local_fs $remote_fs $network $syslog
+# Default-Start:    2 3 4 5
+# Default-Stop:     0 1 6
+# Short-Description:    Test-Suite Remote Agent
+### END INIT INFO
+
+NAME=remote.py
+PY_NAME=python
+DESC='Digium Test-Suite Remote Agent'
+TESTSUITE_INSTALL_PATH=/usr/local/testsuite
+DAEMON=/usr/bin/python
+DAEMON_ARGS=$TESTSUITE_INSTALL_PATH/remote.py
+
+[ -x "$DAEMON" ] || exit 0
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+set -e 
+
+do_start()
+{
+	sudo start-stop-daemon --start --quiet --user root --background --pidfile /var/run/$NAME.pid \
+		--make-pidfile --chdir $TESTSUITE_INSTALL_PATH --exec $DAEMON --test > /dev/null \
+		|| return 1
+        sudo start-stop-daemon --start --quiet --user root --background --pidfile /var/run/$NAME.pid \
+                --make-pidfile --chdir $TESTSUITE_INSTALL_PATH --exec $DAEMON -- $DAEMON_ARGS \
+                || return 2
+}
+
+do_stop()
+{
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /var/run/$NAME.pid --name $PY_NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+	[ "$?" = 2 ] && return 2
+	rm -f $PIDFILE
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+	log_daemon_msg "Starting the $DESC:" "$NAME"
+	do_start
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	log_daemon_msg "Stopping the $DESC:" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  restart)
+	log_daemon_msg "Restarting the $DESC:" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+		log_end_msg 1
+		;;
+	esac
+	;;
+
+  status)
+       	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+	exit 3
+	;;
+esac
+
+exit 0

commit 637e926f3308b99770aa23ce7cf2bb516de9cf8f
Author: Darren Sessions <dsessions at digium.com>
Date:   Tue Jun 14 07:56:07 2011 -0500

    Finished up a tested Makefile. Includes a few fixes like a proper path check and user check.

diff --git a/Makefile b/Makefile
index e8c80fc..136e8e7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,13 @@
 USER=`whoami`
 INSTALLDIR=/usr/local/testsuite
 
-all:
+all: _banner
+	@echo "        +-----------------------------------+ "
+	@echo "        +  Please run, 'sudo make install'  + "
+	@echo "        +-----------------------------------+ "
+	@echo ""
 
-all: _all
+_banner:
 	@echo ""
 	@echo "     _            _                   _ _         "
 	@echo "    | |_ ___  ___| |_       ___ _   _(_) |_ ___   "
@@ -11,6 +15,8 @@ all: _all
 	@echo "    | ||  __/\__ \ ||______\__ \ |_| | | ||  __/  "
 	@echo "     \__\___||___/\__|     |___/\__,_|_|\__\___|  "
 	@echo ""
+
+install: _banner _install
 	@echo "   +----- Test-Suite Installation Complete -----+ "  
 	@echo "   +                                            + "
 	@echo "   +  The test-suite is now installed. An init  + "
@@ -23,21 +29,24 @@ all: _all
 	@echo "   +--------------------------------------------+ "  
 	@echo ""
 
-_all: usercheck install
+_install: usercheck copy
 
 usercheck:
-ifneq ($(USER),root)
-	@echo ""
-	@echo "   ---------------------------------------------------"
-	@echo "   The test-suite must be installed, and ran, as root."
-	@echo "   ---------------------------------------------------"
-	@echo ""
-	@exit 1
-endif
+	@if [ "$(USER)" != "root" ]; then \
+		echo ""; \
+		echo " ---------------------------------------------------"; \
+		echo " The test-suite must be installed, and ran, as root."; \
+		echo " ---------------------------------------------------"; \
+		echo ""; \
+		exit 1; \
+	fi
 
-install:
-	@test -d $(INSTALLDIR) || mkdir -p $(INSTALLDIR)
+copy:
+	@if [ ! -d $(INSTALLDIR) ]; then \
+		mkdir -p $(INSTALLDIR); \
+	fi
 
 	@for f in *; do \
 		test -f $$f && \
 		cp -p $$f $(INSTALLDIR); \
+	done

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list