server-log.sh
#!/bin/sh
current_date=$(date +%Y-%m-%d)
echo '当前日期=>' $current_date
cd /xxx/service/server/xx-safe-control/logs
logname="xxx-safe-control-info-${current_date}.0.log"
echo 'logname==>' $logname
if [ -e ${logname} ]; then
echo "日志文件存在"
tail -fn 300 $logname
else
echo "日志文件不存在"
fi
catGrepLog.sh
#!/bin/sh
if [ "$1" = "" ];
then
echo -e "\033[0;31m 未输入链路id: \033[0m \033[0;34m 如,9af168be1e2daa98 \033[0m"
exit 1
fi
current_date=$(date +%Y-%m-%d)
echo '当前日期=>' $current_date
cd /xx/xx/logs/xx-business
logname="xx-xxx-info-${current_date}.0.log"
echo 'logname==>' $logname
if [ -e ${logname} ]; then
echo "日志文件存在"
cat $logname |grep $1
else
cat $logname |grep
echo "日志文件不存在"
fi
git-branch-opt.sh
#!/bin/sh
function git-branch-name {
git symbolic-ref --short -q HEAD 2>/dev/null
}
function git-branch-prompt {
local branch=`git-branch-name`
if [ $branch ]; then printf " [%s]" $branch; fi
}
parse_git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;33m\]$(parse_git_branch)${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ $branch == *"HEAD"* ];then
branch="`git rev-parse --short HEAD`"
fi
echo "($branch)"
fi
}
export PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;32m\]$(git_branch)\[\033[00m\]\$'