chk_mediaserver.sh

[[email protected] ftpsite]$ cat chk_mediaserver.sh
#!/bin/bash
ps -ef |grep mediaserver |grep -v ‘grep‘
if [ $?!=0 ] ;then
    /opt/app/tv189/services/ticketplatform/mediaserver/src/mediaserver
else
    exit 0;
fi

[[email protected] ftpsite]$ cat chk_mount.sh
#!/bin/bash
df -h |grep 192.168.74.162 |grep -v ‘grep‘
if [ $?!=0 ] ;then
    mount -t nfs 192.168.74.162:/data/other/mpoint /data/other/mpoint
else
    exit 0;
fi

[[email protected] ftpsite]$ cat Logs_Backup.sh
#!/bin/bash
# Filename: Logs_Backup.sh
# Location: /opt/scripts
# NFS: mount -t nfs 192.168.51.110:/data1 /data/Logs_Backup
# runtime: 1:00 every day
# crontab: 0 1 * * * /bin/sh /opt/scripts/Logs_Backup.sh > /opt/scripts/Logs_Backup.log 2>&1
# script log: /opt/scripts/Logs_Backup.log
# +------------------------------------------------------+
# | Three days ago nginx_logs put 192.168.51.110:/data1/ |
# +------------------------------------------------------+

Times=$(date --date ‘3 days ago‘ +‘%Y%m%d‘)
Y=$(echo $Times | cut -b 1-4)
M=$(echo $Times | cut -b 5-6)
D=$(echo $Times | cut -b 7-8)

#Src_Log_Path=/usr/local/tysx/logs
Src_Log_Path=/data/tysx/logs
Dst_Log_Path=/data/Logs_Backup
SERVID=HTTPVod_73_51

/bin/mount -l -t nfs | grep ‘/data1 /data/Logs_Backup‘
declare remount=`echo $?`
if [ $remount == 0 ];then
    /bin/date
    echo "/data/other/mpoint Mount nornall"
else
    /bin/ping 192.168.51.110 -c 1 -w 1
    declare reconnect=`echo $?`
    if [ $reconnect == 0 ];then
        /bin/mount -t nfs 192.168.51.110:/data1 /data/Logs_Backup
        /bin/date
        echo "Mount mpoint again"
    else
        /bin/date
        echo "192.168.51.110 off-line"
        exit 1
    fi
fi
#Check mount of mporint

/bin/mkdir -p $Dst_Log_Path/$Y/$M/$D
#/data/Logs_Backup/2014/09/15/

gzip -N $Src_Log_Path/$Y/$M/access_$Times.log && /bin/mv $Src_Log_Path/$Y/$M/access_$Times.log.gz $Dst_Log_Path/$Y/$M/$D/${SERVID}_access_$Times.log.gz && /bin/rm -rf $Src_Log_Path/$Y/$M/$D

[[email protected] ftpsite]$ cat upload_comment.sh
#!/bin/bash
DATE=$(date -d ‘1 days ago‘ +%Y%m%d)
START_TIME=$(date -d ‘1 days ago‘ +%F)" 00:00:00"
END_TIME=$(date +%F)" 00:00:00"
FILE_NAME=‘comment_‘$DATE‘.txt‘
DIR=‘/shell/upload_comment‘
cd $DIR

echo $START_TIME
echo $END_TIME
mysql -u root PASSWORD << EOF1
    use comment;
    select * from cmm_comment_info_000001 where CreateTime BETWEEN "$START_TIME" and "$END_TIME" into outfile "$DIR/data/$FILE_NAME" fields terminated by "|";
EOF1

sed -i ‘s/\\N//g‘ $DIR/data/$FILE_NAME

ftp -v -n 192.168.40.125 << EOF2
    user fuser 111111
    binary
    prompt
    lcd ./data
    put $FILE_NAME
    close
    bye
EOF2

rm -f ./data/*

[[email protected] shell]$ cat OTTlog.sh
#!/bin/bash
LOGPATH="/data/ftpsite/DataCenter/ottlogs"
DSTPATH="/data/ftpsite/Backup"
DATA=$(/bin/date -d "5 days ago" +%Y%m%d)

if [ -d $LOGPATH/$DATA ];then
    tar -zcf $DSTPATH/OTTLOG$DATA.tar.gz $LOGPATH/$DATA
fi

if [ -f $DSTPATH/OTTLOG$DATA.tar.gz ];then
    rm -rf $LOGPATH/$DATA
fi

[[email protected] shell]$ cat userlogin.sh
#!/bin/bash

Ntime=$(date -d "1 day ago" +"%Y%m%d")

dir1=/data/ftpsite/DataCenter
dir2=/data/ftpsite/DataCenter/tianyikankan
log=/data/ftpsite/shell/userlogin.log

file1="other_user_login_log_"$Ntime".txt"
file2="Client40_user_login_log_"$Ntime".txt"
file3="YiXiuBa_other_user_login_log_"$Ntime".txt"

num1=$(cat $dir1/$file1 |wc -l)
num2=$(cat $dir1/$file2 |wc -l)
num3=$(cat $dir2/$file3 |wc -l)
total=$((num1+num2+num3))

cat $dir1/$file2 >> $dir1/$file1
cat $dir2/$file3 >> $dir1/$file1

#put_data(){
#        /usr/bin/ftp -v -n 192.168.32.234 << END
#                user fuser 111111
#                binary
#        lcd $dir1
#        cd /temp
#                put $file1
#                bye
#END
#}

new_total=$(cat $dir1/$file1 |wc -l)

if [ $total == $new_total ];then
    echo "-------------------" >> $log
    echo "$Ntime:Completed!" >> $log
    echo "Old_Total:$total" >> $log
    echo "New_Total:$new_total" >> $log
#    put_data
else
    echo "-------------------" >> $log
    echo "$Ntime:Error!" >> $log
    echo "Old_Total:$total" >> $log
    echo "New_Total:$new_total" >> $log
fi;

时间: 2024-10-10 08:45:21

chk_mediaserver.sh的相关文章

23.dubbo脚本之stop.sh

#!/bin/bash cd `dirname $0` BIN_DIR=`pwd` cd .. DEPLOY_DIR=`pwd` CONF_DIR=$DEPLOY_DIR/conf SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'` if [ -z "$SERVER_NAME" ]; then     SERVER_NAME=`hostname` fi PID

24.dubbo脚本之server.sh

#!/bin/bash cd `dirname $0` if [ "$1" = "start" ]; then ./start.sh else if [ "$1" = "stop" ]; then ./stop.sh else if [ "$1" = "debug" ]; then ./start.sh debug else if [ "$1" = "res

25.dubbo脚本之restart.sh

#!/bin/bash cd `dirname $0` ./stop.sh ./start.sh

Oracle 11g RAC 二节点root.sh执行报错故障一例

OEL6.X IBM v3500存储多路径配置   http://koumm.blog.51cto.com/703525/1439760 2. 采用RHEL6.5 multipath多路径软件安装采用ASMLIB方式配置ASM共享磁盘成功,但是在第二节点执 行root.sh报如下错误提示,解决方式见3. Disk Group CRS creation failed with the following message:   ORA-15018: diskgroup cannot be creat

当root.sh与ORA-15031相遇

近日处理一个Oracle Grid infrastructure(GI)安装的问题,在执行root.sh过程中失败,并显示下面错误: Disk Group OCR creation failed with the following message: ORA-15018: diskgroup cannot be created ORA-15031: disk specification '/dev/vx/rdsk/dg_db01/lv_vote1' matches no disks    <<

debian和ubuntu的sh dash bash

Ubuntu和debian 的 shell 默认安装的是 dash,而不是 bash.运行以下命令查看 sh 的详细信息,确认 shell 对应的程序是哪个:$ls -al /bin/sh dash 比 bash 更轻,更快.但 bash 却更常用.如果一些命令.脚本等总不能正常执行,有可能是 dash 的原因.比如编译 Android 源代码的时候,如果使用 dash,则有可能编译出错,或者编译的系统不能启动. 通过以下方式可以使 shell 切换回 bash:$sudo dpkg-recon

使用sh库执行shell命令

python中执行shell命令 之前执行shell命令多是通过os.system(shell命令)的方式来执行,比较麻烦. 了解到sh是一个比subprocess好的库,能够执行shell命令 1.查看ip: [[email protected] myblog]# ifconfigeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 172.31.253.193 netmask 255.255.240.0 broadcas

sh, 批量执行Linux命令

step 1:创建一个sh批处理命令文件 # vim /etc/batch_ssh/install_redis.sh step 2:给当前用户,能够执行sh脚本权限# chmod install_redis.sh 777 step 3: 编写要批量执行的命令,read表示等待前端用户输入,sleep表示等待时间单位为 秒. echo '\n begin to install 01 plugin \n'; yum install cpp -y; echo '\n yum finish instal

linux执行sh报错:$’\r’: 未找到命令的解决

背景 执行.sh脚本时出现$'\r': 未找到命令, 原因 是因为命令直接从windows 复制过来导致的 解决 yum install dos2unix dos2unix **.sh 进行转换 再次执行即可