This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This is the shell script to release for something. | |
# | |
############### | |
# -eq -> == | |
# -ne -> != | |
# -gt -> > | |
# -lt -> < | |
# -ge -> >= | |
# -le -> <= | |
################ | |
APP_NAME=test | |
# Check the process count | |
APP_CNT=`/bin/ps -ef | /bin/grep "${APP_NAME}" | /bin/grep -v "grep\|init.d" -c` | |
if [ ${APP_CNT} -gt 0 ]; then | |
echo "${APP_NAME} is already runing..." | |
exit 1 | |
fi | |
echo ${APP_CNT} | |
case "$1" in | |
start) | |
printf "%-50s" "Starting $NAME..." | |
/etc/init.d/${APP_NAME} start | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ]; then | |
echo "successful start" | |
else | |
echo "failure starting" | |
fi | |
;; | |
stop) | |
printf "%-50s" "Starting $NAME..." | |
/etc/init.d/${APP_NAME} stop | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ]; then | |
echo "successful stop" | |
else | |
echo "failure stopping" | |
fi | |
;; | |
*) | |
echo "Usage: $0 {start|stop}" | |
exit 1 | |
esac |