( 转自:https://github.com/qinjx/30min_guides/blob/master/shell.md)什么是Shell脚本示例看个例子吧:#!/bin/shcd ~mkdir shell_tutcd shell_tutfor ((i=0; i bash但在Mac OS上不是...
分类:
系统相关 时间:
2015-11-27 12:29:34
阅读次数:
311
首先要知道你使用的Mac OS X是什么样的Shell,使用命令echo $SHELL如果输出的是:csh或者是tcsh,那么你用的就是C Shell。如果输出的是:bash,sh,zsh,那么你的用的可能就是Bourne Shell的一个变种。Mac OS X 10.2之前默认的是C Shell。...
分类:
数据库 时间:
2015-11-27 06:43:51
阅读次数:
277
当maven装好之后出现$ mvn -versionError: JAVA_HOME is not defined correctly. We cannot execute /usr/libexec/java_home/bin/java解决:$ vim .bash_profile export J....
分类:
编程语言 时间:
2015-11-26 23:19:08
阅读次数:
170
111xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
本文是之前的watchdate的shell脚本的改进wdate,同样先上图:1)脚本加入chkconfig管理head-5/etc/init.d/wdate#!/bin/bash
#auth:chentp0601@qq.com
#
#wdateStart/Stopthewatchdatedaemon
#
#chkconfig:23457155chkconfig--addwdate2)开始贴代码#!/bin/bash
#auth:chentp0601@qq..
分类:
系统相关 时间:
2015-11-26 19:23:32
阅读次数:
252
在应用层面上,会跑很多服务,那么监控系统服务状态就变得很必要了#!/bin/bash
pid(){
psax|grep"APPLICATION"|grep-vgrep>/dev/null2>&1
if[$?-eq0];then
echo1
else
echo0
fi
}
PID=`pid`
post(){
netstat-ntpl|grepPOST-NUMBER>/dev/null2>&1
if[$?-eq0..
分类:
其他好文 时间:
2015-11-26 15:34:05
阅读次数:
117
应用服务写成系统服务,方便日后自动化管理#!/bin/bash
service_dir=/path/to/file
start(){
psax|grep"APPLICATION"|grep-vgrep>/dev/null2>&1
if[$?-eq0];then
echo"APPLICATIONServiceisrunning!!!"
else
echo"StartingAPPLICATIIONService..."
nohupjava-jar$ser..
分类:
其他好文 时间:
2015-11-26 15:33:01
阅读次数:
129
#!/bin/bash fun(){ ps -ef | grep "$1" | awk '{print $2 $8}' > /usr/file while read line ;do if [[ $line == $1 ]] then # do so...
分类:
系统相关 时间:
2015-11-26 01:14:35
阅读次数:
130
本文介绍了linux的多种环境变量配置文件及其作用,并介绍了在正常登录和非正常登录的情况下,环境变量配置文件的执行流程。此外还介绍了source命令用来使环境变量配置文件生效。在本文的最后,额外地介绍了bash_logout,bash_history,/etc/issue等其他环境变量配置文件。
分类:
系统相关 时间:
2015-11-25 23:21:49
阅读次数:
189
先贴效果:
#!/bin/bash
#auth:chentp0601@qq.com
source/etc/init.d/functions
#判断参数个数
[$#-ne1]&&{
echo"usage:$0{start|stop|restart|status}"
exit1
}
#分支
case$1in
start)
nohupwatch-n1date"+%H:%M:%S"&>/tmp/date&
action"starting$0"/bin/t..
分类:
系统相关 时间:
2015-11-25 19:37:03
阅读次数:
198