Project release, write a shell script to start the project, including the start of the project, turn off the restart, including the project log output to the specified file, not for anything else, just for the next project release, you can directly copy the past use of the script. Ha ha..
Copy this shell script and just change the red part to something in your own project and you can run it directly.
Then assign the script to execute permissions on the line: chmod 777-foot name
1./blog.sh Start 2../blog.sh Stop 3../blog.sh restart
#!/bin/sh #工作空间地址 run_dir=/usr/local/blog #项目运行放一些临时文件 cache_dir=/usr/local/blog/cache #配置环境变量 $PATH before reading the environment variable used: to connect Path= $PATH: $RUN _dir #注册环境变量 export PATH #虚拟机的一些配置 is primarily an address. Do not repeat (prevent a server from publishing multiple items), jvm_option= "-agentlib:jdwp=tr ansport=dt_socket,server=y,suspend=n,address=5789 "#这个主要是创建项目工作的文件夹 (created if not present) if [!-d" $CACHE _dir "];
Then echo "${cache_dir} folder does not exist, ready to create!"
Mkdir-p "$CACHE _dir" echo "${cache_dir} folder created successfully!"
Fi # Here's the input./socket.sh start./socket.sh Stop/socket.sh Restart $ is used to receive input instructions case "$" in start echo "Starting bloging ..." # Here's the declaration of the temporary directory log output of the project running to the specified file &A MP; This is meant to run with the >> daemon. Java-jar ${jvm_option}-djava.io.tmpdir= "$CACHE _dir" $RUN _dir/blog.jar-d "$RU N_dir ">> $RUN _dir/log & # Here is the PID that gets the current project running and writes to the PID file to pave the back for the stop. Echo $!
> $RUN _dir/pid;; Stop) echo "Stopping bloging ..." #读取pid文件的项目进程ID
pid=$ (Cat $RUN _dir/pid) # Kill the process of the project kill-9 $PID;;
Restart) echo "Stopping bloging ..."
pid=$ (cat $RUN _dir/pid) kill-9 $PID sleep 2; echo "Starting bloging ..." Java-jar ${jvm_option}-djava.io.tmpdir= "$RUN _dir/cache" $RUN _dir/blog.jar-d "$RUN _dir" & Gt;> $RUN _dir/log & Echo $!
> $RUN _dir/pid;;
*) echo "Usage $ {Start|stop|restart}";; Esac #正常运行程序并退出程序 Exit 0
This is the chart of the project published on the previous server: