Commit fd82c47c by ansible

no message

1 parent 7778e63f
#!/bin/bash
#while read url ; do
# ret=$(curl -I -s "$url" -o /dev/null -w "%{http_code}\n")
# ((ret==200)) && echo "$url" >> new_list_URL
#done < list_URL
ret=$(curl -I -s "http://127.0.0.1:8080/iChatWeb/process/" -o /dev/null -w "%{http_code}\n")
if [ $ret -eq 200 ]
then exit 0
else exit 1
fi
#!/bin/bash
service=$1
cp $service /lib/systemd/system/.
cmd="systemctl enable $service"
run=$(eval $cmd)
echo $run $?
cmd="systemctl list-unit-files $service"
run=$(eval $cmd)
echo $run $?
#!/bin/bash
case $1 in
start) /opt/stack/admin/ctlscript.sh start wildfly;;
stop) /opt/stack/admin/ctlscript.sh stop wildfly;;
status) /opt/stack/admin/ctlscript.sh status wildfly |sed "s/wildfly/admin/g";;
*) echo "not im"
esac
#!/bin/bash
# Allow only root execution
if [ `id|sed -e s/uid=//g -e s/\(.*//g` -ne 0 ]; then
echo "This script requires root privileges"
exit 1
fi
#set -x
export LD_LIBRARY_PATH="/opt/stack/lib/mqtt_lib/:/opt/stack/lib/"
#PID
MQTTPID=/opt/stack/mqtt/log/mqtt.pid
POSTGRESPID=/opt/stack/postgres/postgres/mongodb.pid
MONGOPID=/opt/stack/mongodb/mongodb/tmp/mongodb.pid
JBOSSPID=/opt/stack/wildfly/wildfly/standalone/tmp/jboss.pid
NGINX_WILDFLY_PID=/opt/stack/nginx/logs/nginx.wildfly.pid
NGINX_CHAT_PID=/opt/stack/nginx/logs/nginx.chat.pid
#CMD
# TEST
CMD_TEST_WILDFLY="/opt/stack/script/8080status.sh"
CMD_TEST_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -q -t -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_TEST_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -q -t -c /opt/stack/nginx/conf/nginx.chat.conf"
# START
CMD_START_MONGODB="/opt/stack/mongodb/ctlscript.sh start mongodb"
CMD_START_POSTGRES="/opt/stack/postgres/ctlscript.sh start postgresql"
CMD_START_MQTT="/opt/stack/script/mqtt.sh start"
CMD_START_ADMIN="/opt/stack/admin/ctlscript.sh start wildfly"
CMD_START_RUNTIME="/opt/stack/runtime/ctlscript.sh start wildfly"
CMD_START_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_START_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.chat.conf"
# STOP
CMD_STOP_MONGODB="/opt/stack/mongodb/ctlscript.sh stop mongodb"
CMD_STOP_POSTGRES="/opt/stack/postgres/ctlscript.sh stop postgresql"
CMD_STOP_ADMIN="/opt/stack/admin/ctlscript.sh stop wildfly"
CMD_STOP_RUNTIME="/opt/stack/runtime/ctlscript.sh stop wildfly"
CMD_STOP_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -s stop -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_STOP_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -s stop -c /opt/stack/nginx/conf/nginx.chat.conf"
CMD_STOP_MQTT="/opt/stack/script/mqtt.sh stop"
help()
{
cat <<EOF
help - this screen
start - start the service(s)
EOF
}
do_start()
{
#start mongodb
#set -x
$CMD_START_MONGODB
#start
$CMD_START_POSTGRES
#start mqtt
$CMD_START_MQTT
#start runtime
$CMD_START_RUNTIME
#start admin
$CMD_START_ADMIN
#start nginx for wildfly
if [ -s $NGINX_WILDFLY_PID ]; then
if ps -p $(cat $NGINX_WILDFLY_PID) > /dev/null; then
echo "nginx for wildfly: is running"
STATUS=0
else echo "nginx for wildfly: found PID file but not run"
echo "rm $NGINX_WILDFLY_PID" && rm $NGINX_WILDFLY_PID
STATUS=1
fi
elif [ -f $NGINX_WILDFLY_PID ]; then
echo "nginx for wildfly: PID file size is zero"
echo "rm $NGINX_WILDFLY_PID" && rm $NGINX_WILDFLY_PID
STATUS=1
else STATUS=1
fi
if [ $STATUS -eq 1 ]; then
echo "nginx for wildfly: starting" && $CMD_TEST_NGINX_WILDFLY
if [ $? -eq 0 ]; then
$CMD_START_NGINX_WILDFLY
if [ $? -ne 0 ]; then
return $?
fi
fi
fi
#start nginx for chat
if [ -s $NGINX_CHAT_PID ]; then
if ps -p $(cat $NGINX_CHAT_PID) > /dev/null; then
echo "nginx for chat: is running"
STATUS=0
else echo "nginx for chat: found PID file but not run"
echo "rm $NGINX_CHAT_PID" && rm $NGINX_CHAT_PID
STATUS=1
fi
elif [ -f $NGINX_CHAT_PID ]; then
echo "nginx for chat: PID file size is zero"
echo "rm $NGINX_CHAT_PID" && rm $NGINX_CHAT_PID
STATUS=1
else STATUS=1
fi
if [ $STATUS -eq 1 ]; then
echo "nginx for chat: starting" && $CMD_TEST_NGINX_CHAT
if [ $? -eq 0 ]; then
$CMD_START_NGINX_CHAT
if [ $? -ne 0 ]; then
return $?
fi
fi
fi
#check wildfly start completely
for i in $(seq 1 10)
do $CMD_TEST_WILDFLY
if [ $? -ne 0 ]; then
STATUS=1
sleep 5
else
STATUS=0
break
fi
done
return $STATUS
}
do_stop()
{
$CMD_STOP_NGINX_WILDFLY
$CMD_STOP_NGINX_CHAT
$CMD_STOP_ADMIN
$CMD_STOP_RUNTIME
$CMD_STOP_POSTGRES
$CMD_STOP_MQTT
$CMD_STOP_MONGODB
}
#main
case $1 in
start) do_start
exit $?;;
stop) do_stop;;
*) help
esac
[Unit]
Description=The Virtual Engine
After=syslog.target network.target remote-fs.target nss-lookup.target local-fs.target
[Service]
Type=oneshot
ExecStartPre=/root/bin/decryptopt.py
ExecStop=/opt/stack/script/ctlscript.sh stop
ExecStart=/opt/stack/script/ctlscript.sh start
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
#!/bin/bash
case $1 in
start) /opt/stack/mongodb/ctlscript.sh start mongodb;;
stop) /opt/stack/mongodb/ctlscript.sh stop mongodb;;
status) /opt/stack/mongodb/ctlscript.sh status mongodb;;
*) echo "not im"
esac
#!/bin/bash
export LD_LIBRARY_PATH="/opt/stack/lib/mqtt_lib"
user=mosquitto
PIDFILE=/opt/stack/mqtt/log/mqtt.pid
pid=$(ps -u $user |tail -n 1 |awk '{print $1}')
case $1 in
start) echo -n "Starting MQTT: "
if [ "$pid" = "PID" ]; then
test -f $PIDFILE && rm $PIDFILE
/opt/stack/mqtt/sbin/mosquitto -d -c /opt/stack/mqtt/conf/mosquitto.conf 2>/dev/null
if [ $? -eq 0 ]; then
#ps -u $user |tail -n 1 |awk '{print $1}' 1>$PIDFILE
echo "success"
else echo "failed"
exit 1
fi
else echo "running"
fi
;;
stop) echo -n "Stoping MQTT: "
if [ "$pid" = "PID" ]; then
echo "inactive"
else kill -SIGTERM $pid 2>/dev/null && rm "$PIDFILE"
echo "stopped"
fi
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "mqtt is running"
STATUS=0
else echo "found PID file but not running"
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "mqtt is not running"
STATUS=3
fi
;;
*) echo "not im"
esac
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for CHAT
# Description: Nginx For CHAT
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="NGINX to CHAT"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.chat.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.chat.pid
SCRIPTNAME=/etc/init.d/nginx.chat
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for chat is running"
STATUS=0
else echo "found PID file but not running"
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for chat is not running"
STATUS=3
fi
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
[Unit]
Description=The NGINX reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
StartLimitBurst=100
StartLimitInterval=500
[Service]
Type=forking
PIDFile=/opt/stack/nginx/logs/nginx.tcp.pid
ExecStartPre=/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.tcp.conf -t
ExecStart=/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.tcp.conf
ExecReload=/bin/kill -c /opt/stack/nginx/conf/nginx.tcp.conf -s HUP $MAINPID
ExecStop=/bin/kill -c /opt/stack/nginx/conf/nginx.tcp.conf -s QUIT $MAINPID
PrivateTmp=true
Environment="LD_LIBRARY_PATH=/opt/stack/lib"
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for SSH
# Description: Nginx For SSH
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
ESC="NGINX to SSH"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.tcp.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.tcp.pid
SCRIPTNAME=/etc/init.d/nginx.ssh
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for tcp is running"
STATUS=0
else echo "found PID file but not running"
echo "rm $PIDFILE" && rm $PIDFILE
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for tcp is not running"
STATUS=3
fi
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for WILDFLY
# Description: Nginx For WILDFLY
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="NGINX to WILDFLY"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.wildfly.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.wildfly.pid
SCRIPTNAME=/etc/init.d/nginx.wildfly
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for wildfly is running"
STATUS=0
else echo "found PID file but not run"
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for wildfly is not running"
STATUS=3
fi
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
#!/bin/bash
case $1 in
start) /opt/stack/postgres/ctlscript.sh start postgresql;;
stop) /opt/stack/postgres/ctlscript.sh stop postgresql;;
status) /opt/stack/postgres/ctlscript.sh status postgresql;;
*) echo "not im"
esac
#!/bin/bash
case $1 in
start) /opt/stack/runtime/ctlscript.sh start wildfly;;
stop) /opt/stack/runtime/ctlscript.sh stop wildfly;;
status) /opt/stack/runtime/ctlscript.sh status wildfly |sed "s/wildfly/runtime/g";;
*) echo "not im"
esac
#!/bin/bash
#while read url ; do
# ret=$(curl -I -s "$url" -o /dev/null -w "%{http_code}\n")
# ((ret==200)) && echo "$url" >> new_list_URL
#done < list_URL
ret=$(curl -I -s "http://127.0.0.1:8080/" -o /dev/null -w "%{http_code}\n")
if [ $ret -eq 200 ]
then exit 0
else exit 1
fi
#!/bin/bash
service=$1
cp $service /lib/systemd/system/.
cmd="systemctl enable $service"
run=$(eval $cmd)
echo $run $?
cmd="systemctl list-unit-files $service"
run=$(eval $cmd)
echo $run $?
[Unit]
Description=The Wildfly for admin
After=syslog.target network.target remote-fs.target nss-lookup.target
StartLimitBurst=100
StartLimitInterval=500
[Service]
Type=simple
User=wildfly
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 "JBOSS_PIDFILE=/opt/stack/admin/wildfly/standalone/tmp/jboss.pid" JAVA_HOME=/opt/stack/admin/java
LimitNOFILE=102642
PIDFile=/opt/stack/admin/wildfly/standalone/tmp/jboss.pid
ExecStart=/opt/stack/admin/wildfly/bin/standalone.sh -b 127.0.0.1
ExecStop=/opt/stack/admin/wildfly/bin/jboss-cli.sh --connect controller=127.0.0.1:9890 command=:shutdown
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
#!/bin/bash
case $1 in
start) /opt/stack/admin/ctlscript.sh start wildfly;;
stop) /opt/stack/admin/ctlscript.sh stop wildfly;;
status) /opt/stack/admin/ctlscript.sh status wildfly |sed "s/wildfly/admin/g";;
*) echo "not im"
esac
#!/bin/bash
# Allow only root execution
if [ `id|sed -e s/uid=//g -e s/\(.*//g` -ne 0 ]; then
echo "This script requires root privileges"
exit 1
fi
#set -x
export LD_LIBRARY_PATH="/opt/stack/lib/mqtt_lib/:/opt/stack/lib/"
#PID
NGINX_WILDFLY_PID=/opt/stack/nginx/logs/nginx.wildfly.pid
NGINX_CHAT_PID=/opt/stack/nginx/logs/nginx.chat.pid
NGINX_SSH_PID=/opt/stack/nginx/logs/nginx.tcp.pid
#CMD
# TEST
CMD_TEST_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -q -t -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_TEST_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -q -t -c /opt/stack/nginx/conf/nginx.chat.conf"
CMD_TEST_NGINX_SSH="/opt/stack/nginx/sbin/nginx -q -t -c /opt/stack/nginx/conf/nginx.tcp.conf"
# START
CMD_START_RUNTIME="/opt/stack/runtime/ctlscript.sh start wildfly"
CMD_START_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_START_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.chat.conf"
# STOP
CMD_STOP_RUNTIME="/opt/stack/runtime/ctlscript.sh stop wildfly"
CMD_STOP_NGINX_WILDFLY="/opt/stack/nginx/sbin/nginx -s stop -c /opt/stack/nginx/conf/nginx.wildfly.conf"
CMD_STOP_NGINX_CHAT="/opt/stack/nginx/sbin/nginx -s stop -c /opt/stack/nginx/conf/nginx.chat.conf"
help()
{
cat <<EOF
help - this screen
start - start the service(s)
EOF
}
do_start()
{
#start mongodb
#set -x
#start runtime
$CMD_START_RUNTIME
#start nginx for wildfly
if [ -s $NGINX_WILDFLY_PID ]; then
if ps -p $(cat $NGINX_WILDFLY_PID) > /dev/null; then
echo "nginx for wildfly: is running"
STATUS=0
else echo "nginx for wildfly: found PID file but not run"
echo "rm $NGINX_WILDFLY_PID" && rm $NGINX_WILDFLY_PID
STATUS=1
fi
elif [ -f $NGINX_WILDFLY_PID ]; then
echo "nginx for wildfly: PID file size is zero"
echo "rm $NGINX_WILDFLY_PID" && rm $NGINX_WILDFLY_PID
STATUS=1
else STATUS=1
fi
if [ $STATUS -eq 1 ]; then
echo "nginx for wildfly: starting" && $CMD_TEST_NGINX_WILDFLY
if [ $? -eq 0 ]; then
$CMD_START_NGINX_WILDFLY
if [ $? -ne 0 ]; then
return $?
fi
fi
fi
#start nginx for chat
if [ -s $NGINX_CHAT_PID ]; then
if ps -p $(cat $NGINX_CHAT_PID) > /dev/null; then
echo "nginx for chat: is running"
STATUS=0
else echo "nginx for chat: found PID file but not run"
echo "rm $NGINX_CHAT_PID" && rm $NGINX_CHAT_PID
STATUS=1
fi
elif [ -f $NGINX_CHAT_PID ]; then
echo "nginx for chat: PID file size is zero"
echo "rm $NGINX_CHAT_PID" && rm $NGINX_CHAT_PID
STATUS=1
else STATUS=1
fi
if [ $STATUS -eq 1 ]; then
echo "nginx for chat: starting" && $CMD_TEST_NGINX_CHAT
if [ $? -eq 0 ]; then
$CMD_START_NGINX_CHAT
if [ $? -ne 0 ]; then
return $?
fi
fi
fi
#check wildfly start completely
for i in $(seq 1 10)
do $CMD_TEST_WILDFLY
if [ $? -ne 0 ]; then
STATUS=1
sleep 5
else
STATUS=0
break
fi
done
return $STATUS
}
do_stop()
{
$CMD_STOP_NGINX_WILDFLY
$CMD_STOP_NGINX_CHAT
$CMD_STOP_RUNTIME
}
#main
case $1 in
start) do_start
exit $?;;
stop) do_stop;;
*) help
esac
[Unit]
Description=The Virtual Gateway
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=oneshot
ExecStartPre=/root/bin/decryptopt.py
ExecStop=/opt/stack/script/ctlscript.sh stop
ExecStart=/opt/stack/script/ctlscript.sh start
RemainAfterExit=yes
Environment="LD_LIBRARY_PATH=/opt/stack/lib"
[Install]
WantedBy=multi-user.target
#!/bin/bash
license=$(/opt/iConsole/bin/readlicense /opt/iConsole/security/wdchat.license)
cmd="echo '$license' |jq --raw-output .maxMsg"
maxMsg_var=$(eval $cmd)
cmd="echo '$license' |jq --raw-output .maxNotification"
maxNotification_var=$(eval $cmd)
nginxTemplate="/opt/stack/nginx/conf/template/nginx.wildfly.conf"
nginxConfig="/opt/stack/nginx/conf/nginx.wildfly.conf"
cmd="cat $nginxTemplate |sed -e 's/{maxMsg}/$maxMsg_var/g' |sed -e 's/{maxNotification}/$maxNotification_var/g' > $nginxConfig"
run=$(eval $cmd)
#cmd="/opt/stack/nginx/sbin/nginx -t -c /opt/stack/nginx/conf/new.nginx.wildfly.conf"
#run=$(eval $cmd)
#echo $run
cmd="chown nginx:nginx /opt/stack/nginx/conf/nginx.wildfly.conf"
run=$(eval $cmd)
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for CHAT
# Description: Nginx For CHAT
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="NGINX to CHAT"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.chat.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.chat.pid
SCRIPTNAME=/etc/init.d/nginx.chat
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for chat is running"
STATUS=0
else echo "found PID file but not running"
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for chat is not running"
STATUS=3
fi
exit $STATUS
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
[Unit]
Description=The NGINX reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
StartLimitBurst=100
StartLimitInterval=500
[Service]
Type=forking
PIDFile=/opt/stack/nginx/logs/nginx.tcp.pid
ExecStartPre=/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.tcp.conf -t
ExecStart=/opt/stack/nginx/sbin/nginx -c /opt/stack/nginx/conf/nginx.tcp.conf
ExecReload=/bin/kill -c /opt/stack/nginx/conf/nginx.tcp.conf -s HUP $MAINPID
ExecStop=/bin/kill -c /opt/stack/nginx/conf/nginx.tcp.conf -s QUIT $MAINPID
PrivateTmp=true
Environment="LD_LIBRARY_PATH=/opt/stack/lib"
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for SSH
# Description: Nginx For SSH
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
ESC="NGINX to SSH"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.tcp.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.tcp.pid
SCRIPTNAME=/etc/init.d/nginx.ssh
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for tcp is running"
STATUS=0
else echo "found PID file but not running"
echo "rm $PIDFILE" && rm $PIDFILE
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for tcp is not running"
STATUS=3
fi
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
#! /bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nginx for WILDFLY
# Description: Nginx For WILDFLY
### END INIT INFO
# Author: Sila
#
# Do NOT "set -e"
#### This Code For Read License and Reconfigure Nginx
#### Author: Vana
/opt/stack/script/loadlicense
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="NGINX to WILDFLY"
NAME=nginx
DAEMON=/opt/stack/nginx/sbin/$NAME
DAEMON_ARGS="-c /opt/stack/nginx/conf/nginx.wildfly.conf"
PIDFILE=/opt/stack/nginx/logs/nginx.wildfly.pid
SCRIPTNAME=/etc/init.d/nginx.wildfly
CHUID=nginx
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
#set -x
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- \
# -s stop $DAEMON_ARGS
# [ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
if [ -s $PIDFILE ]; then
if ps -p $(cat $PIDFILE) > /dev/null; then
echo "nginx for wildfly is running"
STATUS=0
else echo "found PID file but not run"
STATUS=1
fi
elif [ -f $PIDFILE ]; then
echo "PID file size is zero and not running"
STATUS=2
else echo "nginx for wildfly is not running"
STATUS=3
fi
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $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
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
#!/bin/bash
case $1 in
start) /opt/stack/runtime/ctlscript.sh start wildfly;;
stop) /opt/stack/runtime/ctlscript.sh stop wildfly;;
status) /opt/stack/runtime/ctlscript.sh status wildfly |sed "s/wildfly/runtime/g";;
*) echo "not im"
esac
No preview for this file type
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!