4621 |
19 Aug 16 |
fredrik |
#!/bin/bash |
3133 |
24 Feb 09 |
gregory |
2 |
# |
4621 |
19 Aug 16 |
fredrik |
# proSEftpd This bash shell script takes care of starting and stopping Proteios SE ftp daeomon |
3133 |
24 Feb 09 |
gregory |
4 |
# |
3133 |
24 Feb 09 |
gregory |
# chkconfig: - 80 20 |
3133 |
24 Feb 09 |
gregory |
6 |
# |
3575 |
23 Feb 10 |
gregory |
PORT=__FTP_CONTROL_PORT__ |
3133 |
24 Feb 09 |
gregory |
MEMORY=64M |
3575 |
23 Feb 10 |
gregory |
temp_dir=__TEMP_FILES_DIR__ |
4430 |
06 Mar 13 |
olle |
tomcat_user=__TOMCAT_USER__ |
3133 |
24 Feb 09 |
gregory |
11 |
|
3539 |
11 Jan 10 |
gregory |
# temp_dir validataion |
3539 |
11 Jan 10 |
gregory |
if [ ! -d "$temp_dir" ]; then |
3539 |
11 Jan 10 |
gregory |
echo "Make sure '$temp_dir' is a directory and created" |
3539 |
11 Jan 10 |
gregory |
exit |
3539 |
11 Jan 10 |
gregory |
fi |
3133 |
24 Feb 09 |
gregory |
17 |
|
4389 |
04 Dec 12 |
olle |
# Initial CATALINA_BASE validation; if not set, set to value of $CATALINA_HOME |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
CATALINA_BASE=$CATALINA_HOME |
4389 |
04 Dec 12 |
olle |
fi |
4389 |
04 Dec 12 |
olle |
22 |
|
4389 |
04 Dec 12 |
olle |
# CATALINA_BASE validation; if not set, try a number of default locations |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
CATALINA_BASE=/srv/tomcat6 |
4389 |
04 Dec 12 |
olle |
fi |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
CATALINA_BASE=/var/lib/tomcat6 |
4389 |
04 Dec 12 |
olle |
fi |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
CATALINA_BASE=/srv/tomcat7 |
4389 |
04 Dec 12 |
olle |
fi |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
CATALINA_BASE=/var/lib/tomcat7 |
4389 |
04 Dec 12 |
olle |
fi |
4389 |
04 Dec 12 |
olle |
if [ ! -d "$CATALINA_BASE" ]; then |
4389 |
04 Dec 12 |
olle |
echo "Set CATALINA_BASE to a valid directory and try again." |
3539 |
11 Jan 10 |
gregory |
exit |
3539 |
11 Jan 10 |
gregory |
fi |
3539 |
11 Jan 10 |
gregory |
40 |
|
3780 |
23 Aug 10 |
gregory |
function add2Classpath |
3780 |
23 Aug 10 |
gregory |
42 |
{ |
3780 |
23 Aug 10 |
gregory |
path=$1 |
3780 |
23 Aug 10 |
gregory |
if [ -f $path ]; then |
3780 |
23 Aug 10 |
gregory |
CLASSPATH=$CLASSPATH:$path |
3780 |
23 Aug 10 |
gregory |
else |
3780 |
23 Aug 10 |
gregory |
echo "$path is missing" |
3780 |
23 Aug 10 |
gregory |
exit 1; |
3780 |
23 Aug 10 |
gregory |
fi |
3780 |
23 Aug 10 |
gregory |
50 |
} |
3780 |
23 Aug 10 |
gregory |
51 |
|
3539 |
11 Jan 10 |
gregory |
# Build classpath |
4389 |
04 Dec 12 |
olle |
INF=$CATALINA_BASE/webapps/proteios/WEB-INF |
3573 |
23 Feb 10 |
gregory |
CLASSPATH=$INF/classes |
3573 |
23 Feb 10 |
gregory |
LIB=$INF/lib |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/backport-util-concurrent.jar |
4423 |
26 Feb 13 |
olle |
add2Classpath $LIB/log4j-1.2.17.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/hibernate3.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/dom4j-1.6.1.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/commons-logging-1.0.4.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/commons-collections-3.1.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/cglib-2.2.jar |
4633 |
23 Nov 17 |
fredrik |
add2Classpath $LIB/mysql-connector-java-5.1.44-bin.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/c3p0-0.9.1.jar |
4423 |
26 Feb 13 |
olle |
add2Classpath $LIB/ehcache-core-2.6.3.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/jta-1.1.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/jaxen-1.1-beta-7.jar |
4423 |
26 Feb 13 |
olle |
add2Classpath $LIB/antlr-2.7.7.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/asm-attrs.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/asm.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/wls_stax.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/sjsxp.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/slf4j-api-1.6.4.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/slf4j-log4j12-1.6.4.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/jsr173_1.0_ri.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/proteios_core.jar |
3780 |
23 Aug 10 |
gregory |
add2Classpath $LIB/proteios_ftpserver.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/javassist-3.12.0.GA.jar |
4394 |
10 Jan 13 |
olle |
add2Classpath $LIB/hibernate-jpa-2.0-api-1.0.1.Final.jar |
3539 |
11 Jan 10 |
gregory |
80 |
|
3539 |
11 Jan 10 |
gregory |
81 |
|
3133 |
24 Feb 09 |
gregory |
case "$1" in |
3539 |
11 Jan 10 |
gregory |
start) |
4430 |
06 Mar 13 |
olle |
su - $tomcat_user -c "nohup java -server -Xmx$MEMORY -cp $CLASSPATH se.lu.thep.coreftpd.ProteiosFTPServerControl -t\"$temp_dir\" -start $PORT&" |
3539 |
11 Jan 10 |
gregory |
echo $CLASSPATH |
3539 |
11 Jan 10 |
gregory |
86 |
;; |
3539 |
11 Jan 10 |
gregory |
stop) |
4430 |
06 Mar 13 |
olle |
su - $tomcat_user -c "nohup java -server -Xmx$MEMORY -cp $CLASSPATH se.lu.thep.coreftpd.ProteiosFTPServerControl -t\"$temp_dir\" -stop $PORT&" |
3539 |
11 Jan 10 |
gregory |
89 |
;; |
3539 |
11 Jan 10 |
gregory |
restart) |
3539 |
11 Jan 10 |
gregory |
$0 stop |
3780 |
23 Aug 10 |
gregory |
sleep 4 |
3539 |
11 Jan 10 |
gregory |
$0 start |
3539 |
11 Jan 10 |
gregory |
94 |
;; |
3539 |
11 Jan 10 |
gregory |
95 |
*) |
3539 |
11 Jan 10 |
gregory |
echo "Usage: $0 [start|stop|restart]" |
3539 |
11 Jan 10 |
gregory |
97 |
;; |
4389 |
04 Dec 12 |
olle |
esac |