Created
November 4, 2016 06:57
-
-
Save betapcode/9b20176a7022ef901842c73b0e7186fd to your computer and use it in GitHub Desktop.
Minaftp auto start | stop | restart | reload | status command services
This file contains hidden or 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 | |
# | |
# chkconfig: - 80 30 | |
# description: auto start minaftp on server | |
# processname: minaftp | |
# PARAMETERS: /sbin/services minaftp start|stop|restart|reload | |
# AUTHOR : betapcode, [email protected], [email protected] | |
# COMPANY: Tamtay JSC | |
# VERSION: 1.0 | |
# CREATED: 04/11/2016 10:31:01 AM | |
MINA_HOME=/etc/init.d | |
MINA_FOLDER=/opt/minaFtp | |
FILENAME='minaftp' | |
PORT=21 | |
USER=MinaFTP | |
PATH_FILE=$MINA_HOME/$FILENAME | |
case "$1" in | |
start) | |
# Main startup | |
cd $MINA_FOLDER | |
bin/ftpd.sh res/conf/ftpd-typical.xml > /dev/null 2>&1 & | |
echo -e "Starting $USER System (port $PORT): \t [ OK ]" | |
;; | |
stop) | |
# Main shutdown | |
MPID=`ps aux | grep java | grep ftpd-typical.xml | awk '{print $2}'` | |
if [ -n "$MPID" ] | |
then | |
#echo $MPID | |
kill -9 $MPID | |
echo -e "Shutdown $USER System (port $PORT): \t [ OK ]" | |
else | |
echo -e "Shutdown $USER System (port $PORT): \t [ Fail ]" | |
fi | |
;; | |
reload|restart) | |
$PATH_FILE stop | |
$PATH_FILE start | |
;; | |
status) | |
MPID=`ps aux | grep java | grep ftpd-typical.xml | awk '{print $2}'` | |
if [ -n "$MPID" ] | |
then | |
echo -e "$USER (pid $MPID) is running..." | |
else | |
echo -e "$USER is stopped" | |
fi | |
;; | |
*) | |
echo "Usage: `basename $0` start|stop|restart|reload" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment