目录
shell
这是平时我在shell开发中常用的一些代码demo
- 注册成为service
[Unit]
Description=lingouu-app.service
After=syslog.target
[Service]
Type=simple
ExecStart=/usr/bin/java -jar /developer/package/lingouu-app-api.jar
Restart=on-failure
[Install]
WantedBy=multi-user.target
- sh文件
#!bin/bash
echo "exec......"
systemctl stop lingouu-app
DATE=$(date +%Y%m%d)
export JAVA_HOME PATH CLASSPATH
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
DIR=/developer/package
JARFILE=lingouu-app-api.jar
if [ ! -d $DIR/backup ];then
mkdir -p $DIR/backup
fi
cd $DIR
if [ -f $DIR/$JARFILE ];then
mv $JARFILE backup/$DATE_$JARFILE.back
fi
mv $DIR/temp/$JARFILE $DIR/$JARFILE
echo "starting......"
systemctl start lingouu-app