2017-08-06 linux Linux下启动Java守护进程方法 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/bin/shDESC="Java Service"NAME=java-servicePIDFILE=/tmp/$NAME.pidPATH_TO_JAR=~/java-service.jarPATH_TO_JAVA=/usr/local/jdk1.8.0_131/bin/javaSERVICE_CONFIG='-Dserver.port=8080 -DLOG_PATH=/var/log'COMMAND="$PATH_TO_JAVA -- $SERVICE_CONFIG -jar $PATH_TO_JAR"d_start() { start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec $COMMAND}d_stop() { start-stop-daemon --stop --quiet --pidfile $PIDFILE if [ -e $PIDFILE ] then rm $PIDFILE fi}case $1 in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; restart) echo -n "Restarting $DESC: $NAME" d_stop sleep 1 d_start echo "." ;; *) echo "usage: $NAME {start|stop|restart}" exit 1 ;;esacexit 0 Newer Spring Boot YAML配置文件设置字段默认值 Older HPKP(HTTP Public Key Pinning)详解