#!/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的更多相关文章

  1. Linux Shell系列教程之(十五) Shell函数简介

    本文是Linux Shell系列教程的第(十五)篇,更多Linux Shell教程请看:Linux Shell系列教程 函数可以将一个复杂功能划分成若干模块,从而使程序结构更加清晰,代码重复利用率更高 ...

  2. Linux Shell基础(下)

    Linux Shell基础(下) 目录 一.shell特殊符号cut命令 二.cut.sort.wc.uniq命令 三.tee.tr.split命令 四.简易审计系统 五.fork, exec, so ...

  3. Linux shell基础知识(上)

    Linux shell基础知识(上) 目录 一.shell介绍 二.命令历史 三.命令补全和别名 四.通配符 五.输入输出重定向 六.管道符和作业控制 七.shell变量 八.环境变量配置文件 九.b ...

  4. Linux Shell 笔记

    1.查看进程的环境变量 普通:$cat /proc/1642/environ  换行:$cat /proc/1642/environ | tr '\0' '\n' tr的命令格式是tr SET1 SE ...

  5. Linux shell脚本基础学习详细介绍(完整版)二

    详细介绍Linux shell脚本基础学习(五) Linux shell脚本基础前面我们在介绍Linux shell脚本的控制流程时,还有一部分内容没讲就是有关here document的内容这里继续 ...

  6. Linux - Shell - shell 执行方式

    概述 shell 的执行方式 背景 偶尔执行个 shell 脚本 一般都用 './script' 执行 最近忽然看到 有不同的执行方式, 感觉有必要整理一下, 然后和大家分享 准备 os centos ...

  7. 一文学完Linux Shell编程,比书都好懂

    一. Shell 编程 1. 简介 Shell 是一个用 C 语言编写的程序,通过 Shell 用户可以访问操作系统内核服务. Shell 既是一种命令语言,又是一种程序设计语言. Shell scr ...

  8. 前端学习 linux —— shell 编程

    前端学习 linux - shell 编程 shell 原意是"外壳",与 kernel(内核)相对应,比喻内核外的一层,是用户和内核沟通的桥梁.shell 有很多种,国内通常使用 ...

  9. linux shell 中的sleep命令

    开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...

随机推荐

  1. 使用Log4Net完成异常日志处理

    1.在MVC的Modal文件夹建一个异常处理过滤器 public class MyExceptionAttribute:HandleErrorAttribute { public static Que ...

  2. RabbitMQ入门教程(转)

    http://blog.csdn.net/column/details/rabbitmq-for-java.html http://blog.csdn.net/anzhsoft/article/det ...

  3. Android SQLite数据库使用

    在Android开发中SQLite起着很重要的作用,网上SQLite的教程有很多很多,不过那些教程大多数都讲得不是很全面.本人总结了一些SQLite的常用的方法,借着论坛的大赛,跟大家分享分享的.一. ...

  4. Animating graphic objects in Windows Forms.

    原文: Animating graphic objects in Windows Forms. http://bobpowell.net/animation.aspx 文件下载备份:http://fi ...

  5. linux dynamic debug 官方教程

    下载内核后,文档在:Documentation/dynamic-debug-howto.txt 中文版本:http://www.oschina.net/translate/dynamic-debug- ...

  6. MQ框架的比较

    MQ框架的比较 MQ框架非常之多,比较流行的有RabbitMq.ActiveMq.ZeroMq.kafka.这几种MQ到底应该选择哪个?要根据自己项目的业务场景和需求.下面我列出这些MQ之间的对比数据 ...

  7. [问题2015S03] 复旦高等代数 II(14级)每周一题(第四教学周)

    [问题2015S03]  设 \(g(x)=x^n+a_1x^{n-1}+\cdots+a_{n-1}x+a_n\) 是数域 \(\mathbb{K}\) 上的多项式, \(V\) 是 \(\math ...

  8. CentOS7 续续

    1.配置网络,虚拟机为桥接模式,IP地址为 192.168.100+学号/24,配置完成后可以通过ping物理机192.168.100段,或者ping 192.168.100.140验证2.通过临时与 ...

  9. faster alter table add column

    Create a new table (using the structure of the current table) with the new column(s) included. execu ...

  10. react项目组件化思考

    三个原则 single store render from top immutable data single store,便于组件之间通信. render from top,因为store就一个,每 ...