Linux 脚本示例-----xiaoxu
来源:互联网 发布:三层网络配置实例 编辑:程序博客网 时间:2024/06/16 17:05
1、示例一
#/bin/sh
startTime=$1endTime=$2
basePath=/work/embrace/cruserPassengerRedis/cruserPassengerLog
dataWholePath=$basePath/${startTime:0:8}020101/access.log
promptInfo="example: sh start-recoveryRedis.sh 20170713104500 20170713104600"
runPath=/work/embrace/cruserPassengerRedis/runJar/cruserPassenger-0.0.1-version-205.jar
currentClass=com.otsuser.usualpassenger.readLog.RecoveryRedis
runLog=/work/embrace/cruserPassengerRedis/recoveryRedisLog/$startTime-$endTime-recoveryRedis.log
cd /work/embrace/cruserPassengerRedis/jdk1.7/bin
if [ -z "$startTime" ]; then
echo "++++ startTime is null ++++"
echo $promptInfo
elif [ -z "$endTime" ]; then
echo "++++ endTime is null ++++"
echo $promptInfo
elif [ "${#startTime}" -lt 14 -o "${#startTime}" -gt 14 ]; then
echo "++++ startTime length not equal 14 ++++"
echo $promptInfo
elif [ "${#endTime}" -lt 14 -o "${#endTime}" -gt 14 ]; then
echo "++++ endTime length not equal 14 ++++"
echo $promptInfo
elif [ $startTime -gt $endTime ]; then
echo "++++ startTime gt endTime ++++"
echo $promptInfo
fi
if [ "${#startTime}" -eq 14 -a "${#endTime}" -eq 14 ] && [ $startTime -lt $endTime ]; then
echo "---------------------"$startTime $endTime
echo $runPath $currentClass $dataWholePath $startTime $endTime $runLog
./java -cp $runPath $currentClass $dataWholePath $startTime $endTime >> $runLog
else
echo "++++ startTime equel endTime ++++"
echo echo $promptInfo
fi
# 后端启动
# 2>&1 &
2、实例二
#!/bin/sh
# save log sh
runLogPath=/work/embrace/cruserPassengerRedis/runLog
cruserPassengerLogPath=/work/embrace/cruserPassengerRedis/cruserPassengerLog
redis012=WebQueuePassenger-redis-012.log
#!/bin/sh
# save log sh
runLogPath=/work/embrace/cruserPassengerRedis/runLog
cruserPassengerLogPath=/work/embrace/cruserPassengerRedis/cruserPassengerLog
redis012=WebQueuePassenger-redis-012.log
redis345=WebQueuePassenger-redis-345.log
redis6789=WebQueuePassenger-redis-6789.log
cd $cruserPassengerLogPath
currnetDay=`date +%Y%m%d%H%M%S`
mkdir $currnetDay
touch $cruserPassengerLogPath/$currnetDay/access.log
cp $runLogPath/$redis012 $cruserPassengerLogPath/$currnetDay
cp $runLogPath/$redis345 $cruserPassengerLogPath/$currnetDay
cp $runLogPath/$redis6789 $cruserPassengerLogPath/$currnetDay
echo "12" > $runLogPath/$redis012
echo "345" > $runLogPath/$redis345
echo "6789" > $runLogPath/$redis6789
cat $cruserPassengerLogPath/$currnetDay/$redis012 | grep -a -E 'insert:|update:|delete:' >> $cruserPassengerLogPath/$currnetDay/access.log
cat $cruserPassengerLogPath/$currnetDay/$redis345 | grep -a -E 'insert:|update:|delete:' >> $cruserPassengerLogPath/$currnetDay/access.log
cat $cruserPassengerLogPath/$currnetDay/$redis6789 | grep -a -E 'insert:|update:|delete:' >> $cruserPassengerLogPath/$currnetDay/access.log
3、示例三
#!/bin/sh
basepath=$(cd `dirname $0`; pwd)
baseName=`basename $0`
echo $basepath
echo $baseName
- Linux 脚本示例-----xiaoxu
- linux脚本编写示例
- Linux shell 脚本示例
- linux shell脚本简单示例
- linux启动脚本讲解+示例 (chkconfig)
- Linux下JAVA应用启动脚本示例
- linux添加开机自启动脚本示例
- 脚本示例
- 两台linux服务器同步目录的脚本示例
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- Linux 常用命令解析及Bash Shell脚本用法示例
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- linux添加开机自启动脚本示例详解
- java获取系统时间(string和date)
- c++生成临时文件名tmpnam()
- 关于Mac上Mysql5.7编码解决
- 游戏开发中的人工智能(五):以势函数实现移动
- python 编码格式
- Linux 脚本示例-----xiaoxu
- bzoj4542 [HNOI2016]大数(莫队+离散化+数学)
- LintCode 376 Binary Tree Path sum
- Kafka源码解析(一)core.kafka.server.KafkaServer
- Android USB Host U盘
- Java:基础之类(Scanner、Radom)
- Mysql语句执行顺序
- 父类子类中的执行顺序
- Oracle和MySQL的几点区别