mirror of https://github.com/tp4a/teleport
builder scripts works on linux now.
parent
43651ea004
commit
c6f0b24680
|
@ -0,0 +1,59 @@
|
|||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: eomsoft
|
||||
# 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: starts the teleport daemon
|
||||
# Description: start or stop teleport service daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON_PATH=/usr/local/eom/teleport
|
||||
NAME=teleport
|
||||
DESC=teleport
|
||||
|
||||
# test -f "$DAEMON_PATH/teleport.sh" || exit 0
|
||||
|
||||
test -f "$DAEMON_PATH/start.sh" || exit 0
|
||||
test -f "$DAEMON_PATH/stop.sh" || exit 0
|
||||
test -f "$DAEMON_PATH/status.sh" || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
# . /lib/lsb/init-functions
|
||||
|
||||
SRV=all
|
||||
if [ x$2 != x ]; then
|
||||
SRV=$2
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
$DAEMON_PATH/start.sh $SRV
|
||||
;;
|
||||
|
||||
stop)
|
||||
$DAEMON_PATH/stop.sh $SRV
|
||||
;;
|
||||
|
||||
restart)
|
||||
$DAEMON_PATH/stop.sh $SRV
|
||||
sleep 2
|
||||
$DAEMON_PATH/start.sh $SRV
|
||||
sleep 2
|
||||
$DAEMON_PATH/status.sh $SRV
|
||||
;;
|
||||
|
||||
status)
|
||||
$DAEMON_PATH/status.sh $SRV
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash
|
||||
|
||||
####################################################################
|
||||
# EOM Teleport Server Install Script
|
||||
####################################################################
|
||||
|
||||
if [ `id -u` -ne 0 ];then
|
||||
echo ""
|
||||
echo -e "\e[31mPlease run the installer with ROOT.\033[0m"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
PATH_ROOT=$(cd "$(dirname "$0")"; pwd)
|
||||
PATH_TARGET=/usr/local/eom
|
||||
|
||||
if [ ! -d "${PATH_TARGET}" ]; then
|
||||
mkdir -p "${PATH_TARGET}"
|
||||
else
|
||||
if [ -f /etc/init.d/eom_ts ]; then
|
||||
service eom_ts stop
|
||||
rm -rf /etc/init.d/eom_ts
|
||||
fi
|
||||
if [ -f /etc/rc2.d/S50eom_ts ]; then
|
||||
rm -rf /etc/rc2.d/S50eom_ts
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/teleport ]; then
|
||||
service teleport stop
|
||||
rm -rf /etc/init.d/teleport
|
||||
fi
|
||||
if [ -f /etc/rc2.d/S50teleport ]; then
|
||||
rm -rf /etc/rc2.d/S50teleport
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installing EOM Teleport Server..."
|
||||
|
||||
cd "${PATH_TARGET}"
|
||||
tar -zxvf "${PATH_ROOT}/data/teleport.tar.gz" >/dev/null
|
||||
cd "${PATH_ROOT}"
|
||||
|
||||
if [ ! -d "${PATH_TARGET}/teleport/etc" ]; then
|
||||
cp -r "${PATH_TARGET}/teleport/tmp/etc" "${PATH_TARGET}/teleport/etc"
|
||||
else
|
||||
if [ ! -f "${PATH_TARGET}/teleport/etc/web.ini" ]; then
|
||||
cp "${PATH_TARGET}/teleport/tmp/etc/web.ini" "${PATH_TARGET}/teleport/etc/web.ini"
|
||||
fi
|
||||
if [ ! -f "${PATH_TARGET}/teleport/etc/core.ini" ]; then
|
||||
cp "${PATH_TARGET}/teleport/tmp/etc/core.ini" "${PATH_TARGET}/teleport/etc/core.ini"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "${PATH_TARGET}/teleport/data" ]; then
|
||||
cp -r "${PATH_TARGET}/teleport/tmp/data" "${PATH_TARGET}/teleport/data"
|
||||
fi
|
||||
|
||||
chmod +x "${PATH_TARGET}/teleport/bin/tp_core"
|
||||
chmod +x "${PATH_TARGET}/teleport/bin/tp_web"
|
||||
|
||||
echo "Generate daemon startup script..."
|
||||
|
||||
cp "${PATH_ROOT}/data/start.sh" "${PATH_TARGET}/teleport/."
|
||||
chmod +x "${PATH_TARGET}/teleport/start.sh"
|
||||
cp "${PATH_ROOT}/data/stop.sh" "${PATH_TARGET}/teleport/."
|
||||
chmod +x "${PATH_TARGET}/teleport/stop.sh"
|
||||
cp "${PATH_ROOT}/data/status.sh" "${PATH_TARGET}/teleport/."
|
||||
chmod +x "${PATH_TARGET}/teleport/status.sh"
|
||||
|
||||
cp "${PATH_ROOT}/data/daemon" /etc/init.d/teleport
|
||||
chmod +x /etc/init.d/teleport
|
||||
|
||||
if [ -f /etc/rc2.d/S50teleport ]; then
|
||||
rm -rf /etc/rc2.d/S50teleport
|
||||
fi
|
||||
ln -s /etc/init.d/teleport /etc/rc2.d/S50teleport
|
||||
|
||||
# Upgrade database...
|
||||
"${PATH_TARGET}/teleport/bin/tp_web" --py "${PATH_TARGET}/teleport/www/teleport/app/eom_upgrade.py"
|
||||
|
||||
echo ""
|
||||
echo "Start teleport server..."
|
||||
echo ""
|
||||
service teleport start
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "Check teleport server status..."
|
||||
echo ""
|
||||
service teleport status
|
||||
echo ""
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "\e[32mInstallation done.\033[0m"
|
||||
echo ""
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
SRV=all
|
||||
if [ x$1 != x ]; then
|
||||
SRV=$1
|
||||
fi
|
||||
|
||||
APP_PATH=/usr/local/eom/teleport
|
||||
|
||||
cd "${APP_PATH}"
|
||||
|
||||
# start teleport core server...
|
||||
if [ $SRV == all ] || [ $SRV == core ] ; then
|
||||
echo -n "starting teleport core server ... "
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_core start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
echo "already running, skip."
|
||||
else
|
||||
${APP_PATH}/bin/tp_core start
|
||||
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_core start" | grep -v grep | wc -l )
|
||||
if [ ! $result -gt 0 ]; then
|
||||
echo -e "\e[31m[FAILED]\033[0m"
|
||||
else
|
||||
echo -e "\e[32m[done]\033[0m"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# start web
|
||||
if [ $SRV == all ] || [ $SRV == web ] ; then
|
||||
echo -n "starting teleport web ... "
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_web start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
echo "already running, skip."
|
||||
else
|
||||
${APP_PATH}/bin/tp_web start
|
||||
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_web start" | grep -v grep | wc -l )
|
||||
if [ ! $result -gt 0 ]; then
|
||||
echo -e "\e[31m[FAILED]\033[0m"
|
||||
else
|
||||
echo -e "\e[32m[done]\033[0m"
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
APP_PATH=/usr/local/eom/teleport
|
||||
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_core start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
# echo "teleport core server is running."
|
||||
echo -e "teleport core server is \e[32mrunning\033[0m."
|
||||
else
|
||||
# echo "teleport core server is not running."
|
||||
echo -e "teleport core server is \e[31mnot running\033[0m."
|
||||
fi
|
||||
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_web start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
# echo "teleport web is running."
|
||||
echo -e "teleport web server is \e[32mrunning\033[0m."
|
||||
else
|
||||
# echo "teleport web is not running."
|
||||
echo -e "teleport web server is \e[31mnot running\033[0m."
|
||||
fi
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
SRV=all
|
||||
if [ x$1 != x ]; then
|
||||
SRV=$1
|
||||
fi
|
||||
|
||||
APP_PATH=/usr/local/eom/teleport
|
||||
|
||||
# start teleport core server...
|
||||
if [ $SRV == all ] || [ $SRV == core ] ; then
|
||||
echo -n "stoping teleport core server ... "
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_core start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
ps ax | grep "${APP_PATH}/bin/tp_core start" | grep -v grep | kill `awk '{print $1}'`
|
||||
echo 'done.'
|
||||
else
|
||||
echo "not running, skip."
|
||||
fi
|
||||
fi
|
||||
|
||||
# stop web
|
||||
if [ $SRV == all ] || [ $SRV == web ] ; then
|
||||
echo -n "stoping teleport web ... "
|
||||
result=$( ps ax | grep "${APP_PATH}/bin/tp_web start" | grep -v grep | wc -l )
|
||||
if [ $result -gt 0 ]; then
|
||||
ps ax | grep "${APP_PATH}/bin/tp_web start" | grep -v grep | kill `awk '{print $1}'`
|
||||
echo 'done.'
|
||||
else
|
||||
echo "not running, skip."
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
####################################################################
|
||||
# EOM Teleport Server Uninstall Script
|
||||
####################################################################
|
||||
|
||||
if [ `id -u` -ne 0 ];then
|
||||
echo ""
|
||||
echo -e "\e[31mPlease run the uninstaller with ROOT.\033[0m"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Uninstalling EOM Teleport Server..."
|
||||
|
||||
if [ -f /etc/init.d/eom_ts ]; then
|
||||
service eom_ts stop
|
||||
rm -rf /etc/init.d/eom_ts
|
||||
fi
|
||||
if [ -f /etc/rc2.d/S50eom_ts ]; then
|
||||
rm -rf /etc/rc2.d/S50eom_ts
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/teleport ]; then
|
||||
service teleport stop
|
||||
rm -rf /etc/init.d/teleport
|
||||
fi
|
||||
if [ -f /etc/rc2.d/S50teleport ]; then
|
||||
rm -rf /etc/rc2.d/S50teleport
|
||||
fi
|
||||
|
||||
|
||||
if [ -d /usr/local/eom/teleport ]; then
|
||||
rm -rf /usr/local/eom/teleport
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "\e[32mUninstallation done.\033[0m"
|
||||
echo ""
|
Loading…
Reference in New Issue