Linux Shell Demo
#!/bin/sh for p in ./*
do
if test -d $p
then
touch $p".ok"
if test -f $p"/busi.xml"
then
echo "delete ${p}/busi.xml..."
rm $p"/busi.xml"
fi for z in $(find $p -name "*.zip")
do
echo "delete ${z}..."
rm $z
done
fi
done
#!/bin/sh while true
do
read -p "please input look or restart servername:" cmd if [ "look" = "$cmd" ]
then
ps -ef | grep java | awk '
function add(a , st , lee , vv , sv , slen , subss , arrs) {
match(a , /Dweblogic.Name=([^ ]+)/);
vv = substr(a ,RSTART,RLENGTH);
split(vv , arrs , "=");
if(arrs[]){
print arrs[];
}
}
{ add($);}'
else
strRes=`echo $cmd | awk -F ' ' '{print $2;}'`
strCmd=`echo $cmd | awk -F ' ' '{print $1;}'`
if [ $strCmd = "restart" ]
then
strPid=
echo `ps -ef | grep java | awk '
function addr(a , st , lee , vv , sv , slen , subss , arrs) {
lee = "Dweblogic.Name="st
if(index(a , lee) > ){
print a;
}
}
{ addr($ , strRes);}' strRes="$strRes" | awk -F ' ' '{print $}'` > pid.temp # echo `cat pid.temp`
strPid=$(cat pid.temp)
kill - $strPid
sd=$(`echo find ~/user_projects -name $strRes`)
cd $sd
rm -rf ./tmp
cd ../../bin
ls -l
read -p "please input start sh name:" shcus
./$shcus".sh"
echo $shcus" is start..."
cd ~/nohuplog
ls -l
read -p "please input rizhi name:" shcusrizhi
tail -200f $shcusrizhi".log"
fi
# end if [ $strCmd = "restart" ] fi
done
脚本1 , 在同级目录,根据文件夹创建ok 文件。
脚本2 , 杀进程,启动服务。
Linux Shell Demo的更多相关文章
- Linux Shell系列教程之(十五) Shell函数简介
本文是Linux Shell系列教程的第(十五)篇,更多Linux Shell教程请看:Linux Shell系列教程 函数可以将一个复杂功能划分成若干模块,从而使程序结构更加清晰,代码重复利用率更高 ...
- Linux Shell基础(下)
Linux Shell基础(下) 目录 一.shell特殊符号cut命令 二.cut.sort.wc.uniq命令 三.tee.tr.split命令 四.简易审计系统 五.fork, exec, so ...
- Linux shell基础知识(上)
Linux shell基础知识(上) 目录 一.shell介绍 二.命令历史 三.命令补全和别名 四.通配符 五.输入输出重定向 六.管道符和作业控制 七.shell变量 八.环境变量配置文件 九.b ...
- Linux Shell 笔记
1.查看进程的环境变量 普通:$cat /proc/1642/environ 换行:$cat /proc/1642/environ | tr '\0' '\n' tr的命令格式是tr SET1 SE ...
- Linux shell脚本基础学习详细介绍(完整版)二
详细介绍Linux shell脚本基础学习(五) Linux shell脚本基础前面我们在介绍Linux shell脚本的控制流程时,还有一部分内容没讲就是有关here document的内容这里继续 ...
- Linux - Shell - shell 执行方式
概述 shell 的执行方式 背景 偶尔执行个 shell 脚本 一般都用 './script' 执行 最近忽然看到 有不同的执行方式, 感觉有必要整理一下, 然后和大家分享 准备 os centos ...
- 一文学完Linux Shell编程,比书都好懂
一. Shell 编程 1. 简介 Shell 是一个用 C 语言编写的程序,通过 Shell 用户可以访问操作系统内核服务. Shell 既是一种命令语言,又是一种程序设计语言. Shell scr ...
- 前端学习 linux —— shell 编程
前端学习 linux - shell 编程 shell 原意是"外壳",与 kernel(内核)相对应,比喻内核外的一层,是用户和内核沟通的桥梁.shell 有很多种,国内通常使用 ...
- linux shell 中的sleep命令
开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...
随机推荐
- Latent Dirichlet Allocation 文本分类主题模型
文本提取特征常用的模型有:1.Bag-of-words:最原始的特征集,一个单词/分词就是一个特征.往往一个数据集就会有上万个特征:有一些简单的指标可以帮助筛选掉一些对分类没帮助的词语,例如去停词,计 ...
- C++学习笔记(1)——数据类型占空间大小
boolean bool 1 byte character char 1 byte May be signed or unsigned wchar_t 1 byte char16_t ...
- xml问题报错处理
添加个classPath:/ 保存下就能解决报错了 /后面要加个空格,最后一行尖括号里面不能有空格.
- Jquery 处理字符串
1.去掉空格var txt=$.trim($("txt1").val()); 2.转为数字 txtNum=Number($.trim(txt)) + 1; var thisEle ...
- noi 4978 宠物小精灵之收服
题目链接:http://noi.openjudge.cn/ch0206/4978/ 二维费用背包 在最后找还剩多少体力的时候,直接找到第二维,当结果 f[n][i] == f[n][m] 时,就说明已 ...
- # TypeScript 中如何确保 this 的正确性
问题 在 TS 里面 this 关键字一开始让我这个写 C# 的十分惊讶,比如下面的一段代码,注意 initBinding 方法 class Company { id:number; /** * 在点 ...
- CSS简写指南(转)
高效的css写法中的一条就是使用简写.通过简写可以让你的CSS文件更小,更易读.而了解CSS属性简写也是前端开发工程师的基本功之一.今天我们系统地总结一下CSS属性的缩写. 1.色彩缩写 色彩的缩写最 ...
- 【树莓派】使用树莓派制作img镜像(二)
树莓派制作的镜像,需要如何使用,这里直接引用目前树莓派官方的文章,不再重复描述: 参考:http://shumeipai.nxez.com/2013/08/31/usb-image-tool.html ...
- 关于C++虚函数的一点点~~
Talk is cheap, show you the code: 1.(普通的) #include<cstdio> class B { public: void func() const ...
- C++成员变量内存对齐问题,ndk下非对齐的内存访问导致BUS_ADRALN
同样的代码,在vs下运行正常,在android ndk下却崩溃: signal 7(SIGBUS),code 1 (BUS_ADRALN),fault addr 0xe6b82793 Func(sho ...