Skip to content

Instantly share code, notes, and snippets.

@smintz
Created August 31, 2016 08:34
Show Gist options
  • Save smintz/534a6e2ff1d0510d029cf0d5618e8165 to your computer and use it in GitHub Desktop.
Save smintz/534a6e2ff1d0510d029cf0d5618e8165 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
################################################
# Don't edit anything below this unless you
# know what your doing
################################################
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$BIN_DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source $BIN_DIR/ccenv
cd $CIPHERCLOUD_GATEWAY_HOME
echo " " >>$CIPHERCLOUD_HOME/logs/shell.log
echo "Started CipherCloud gateway at `date`" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "Script $0 with the following command:" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "java -server -Xms$FWD_PRXY_HEAP_SIZE -Xmx$FWD_PRXY_HEAP_SIZE" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "-XX:NewSize=$CCG_NEW_SIZEm" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "-XX:+UseConcMarkSweepGC -XX:+UseTLAB -XX:+AggressiveOpts -XX:ParallelGCThreads=8 -XX:+UseAES -XX:+UseAESIntrinsics -XX:+IgnoreUnrecognizedVMOptions" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "-Dcom.ciphercloud.userName=$CCUSER -Dcom.ciphercloud.groupName=$CCGROUP -Dcom.ciphercloud.umask=0077" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "-cp $CIPHERCLOUD_HOME/overrides:$CIPHERCLOUD_HOME/conf:$CIPHERCLOUD_GATEWAY_HOME/mail/conf:"$CIPHERCLOUD_GATEWAY_HOME/hotfix/*":$CIPHERCLOUD_GATEWAY_HOME/lib/$CC_PROXY_DAEMON_JAR:$CIPHERCLOUD_GATEWAY_HOME/hotfix/*:$CIPHERCLOUD_GATEWAY_HOME/lib/*" >>$CIPHERCLOUD_HOME/logs/shell.log
echo "com.ciphercloud.proxy.daemon.ProxyDaemonLauncher" >>$CIPHERCLOUD_HOME/logs/shell.log
echo " " >>$CIPHERCLOUD_HOME/logs/shell.log
cd $CIPHERCLOUD_GATEWAY_HOME
$JAVA_HOME/bin/java -server \
-javaagent:$SPRING_INSTR_JAR \
-Xms"$FWD_PRXY_HEAP_SIZE"m -Xmx"$FWD_PRXY_HEAP_SIZE"m \
-XX:NewSize="$CCG_NEW_SIZE"m \
-XX:HeapDumpPath=$CIPHERCLOUD_HOME/logs/ \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:+UseAES \
-XX:+UseG1GC \
-XX:+UseAESIntrinsics \
-XX:ErrorFile=$CIPHERCLOUD_HOME/logs/hs_err_pid_%p.log \
-Dspring.profiles.active=non-management-center \
-Dhazelcast.cluster.node.is.full.member=true \
-XX:ParallelGCThreads=10 \
-Dfile.encoding="UTF-8" \
-Djava.net.preferIPv4Stack=true \
-Dreconstruct.web.apps=false \
-Dstartup.type=forward-proxy \
-Dspring.config.classes=com.ciphercloud.ProxySpringConfiguration \
-Dhazelcast.logging.type=slf4j \
#to-do Need to handle IPV6 resolving hosts in netty
#-Dsun.net.spi.nameservice.provider.1=dns,dnsjava \
#-Dun.net.spi.nameservice.nameservers=8.8.8.8 \
#-Dsun.net.spi.nameservice.provider.2=dns,sun \
#-Dsun.net.spi.nameservice.provider.3=default \
-Dsun.net.inetaddr.ttl=3600 \
-Dsun.net.inetaddr.negative.ttl=3600 \
-Dapp.components=forwardProxy \
-cp $CIPHERCLOUD_HOME/overrides:$CIPHERCLOUD_HOME/conf:$CIPHERCLOUD_GATEWAY_HOME/email:$CIPHERCLOUD_GATEWAY_HOME/hotfix:"$CIPHERCLOUD_GATEWAY_HOME/hotfix/*":$CIPHERCLOUD_GATEWAY_HOME/lib/$CC_PROXY_DAEMON_JAR:"$CIPHERCLOUD_GATEWAY_HOME/lib/*" \
com.ciphercloud.server.GenericProcessLauncher forwardProxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment