Shell Script
#!/bin/bash# setting up the JDK environment export Java_home=/usr/java/jdk1.8.0_45export jre_home= $JAVA _home/jreexport classpath=.: $JAVA _ Home/lib: $JRE _home/lib: $CLASSPATHexport path= $JAVA _home/bin: $JRE _home/bin: $PATH ################################ # # # #环境变量及程序执行参数 # You need to modify these parameters according to the actual environment and the Java program name ################################### #需要启动的Java主程序 (Main method Class) jar_file= " Schedule.server-1.0-snapshot.jar "#项目路径APP_HOME ="/home/robin/wallet_push "#环境配置ENV_OPTS ="-- Spring.profiles.active=release "spring_config_location="--spring.config.location= $APP _home/release/ Job.properties, $APP _home/release/application.properties, $APP _home/release/quartz.properties "#端口号SERVER_PORT =" 8085 "#java虚拟机启动参数JAVA_OPTS ="-ms512m-mx512m-xmn256m-djava.awt.headless=true-xx:maxpermsize=128m- Dsun.net.http.allowrestrictedheaders=true "#################################### get Process Idpid=0checkpid () {Server_pid =$ (pgrep-f $JAR _file) If [-N ' $server _pid "]; Then pid= ' echo $server _pid ' else pid=0 Fi}start () {echo "Ready to start $JAR _file" chEckpid if [0-ne $pid] then echo "Warn:server started already!" else Java $JAVA _ops-jar $JAR _file--server.port= $SERVER _port $SPRING _config_location > Stdout.log & Sleep 3s if [0-ne $pid] then echo "warining:failed" Else echo "Server Started" fi fi}stop () {checkpid if [0-ne $pid] then kill- 9 $pid checkpid If [0-eq $pid] then echo "Server stoped" Else echo "Warning:server toped failed!" Fi else echo ' warning:server not started! ' Fi}case $ in start) start; restart) stop start;; stop) stop;; Esac
Linux Deployment Scripts