疯狂的baidu
Index of /sql
Index of /bin
- Parent Directory
- backupdatabase.jx.sh
- backupdatabase.sh
- backupdatabase.zjm.sh
- daily.sh
- musicstat.sh
- sysnchronize.sh
后台地址:http://mu.baidu.com/admin/
联系管理员
sql里边几个有意思的信息:
在http://mu.baidu.com/sql/mu.sql 中
CREATE DATABASE mu;
CREATE TABLE `admin` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`aname` varchar(255) NOT NULL DEFAULT '',
`pwd` varchar(40) NOT NULL DEFAULT '',
`createtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastlogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`logintimes` int(11) NOT NULL DEFAULT '0',
`operator` int(11) NOT NULL DEFAULT '0',
`level` int(1) NOT NULL DEFAULT '0',
`acid` int(11) NOT NULL DEFAULT '0',
`astatus` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`aid`)
) TYPE=MyISAM
在http://mu.baidu.com/sql/music.sql 的最后
INSERT INTO admin SET aname='admin', pwd='Baidu_music_man@ge', level=9;
backupdatabase.jx.sh 中
EMAIL='yejiaming@baidu.com'
MOBILE='13911618190'
musicstat.sh 中
RECEIVER='lina@baidu.com, guoyi@baidu.com, chenyan@baidu.com, yejiaming@baidu.com'
sysnchronize.sh 中
cd $MUSICROOT
for host in $REMOTEHOST
do
if [ $LOCAL = $host ]
then
continue;
else
scp -r upload work@${host}:web/music/
fi
done
好啦上边摘要百度音乐值班的脚本,下边看看完整的脚本
/* http://mu.baidu.com/sql/mu.sql
*/
CREATE DATABASE mu;
CREATE TABLE `admin` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`aname` varchar(255) NOT NULL DEFAULT '',
`pwd` varchar(40) NOT NULL DEFAULT '',
`createtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastlogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`logintimes` int(11) NOT NULL DEFAULT '0',
`operator` int(11) NOT NULL DEFAULT '0',
`level` int(1) NOT NULL DEFAULT '0',
`acid` int(11) NOT NULL DEFAULT '0',
`astatus` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`aid`)
) TYPE=MyISAM
CREATE TABLE `adminlog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`agaid` int(11) NOT NULL DEFAULT '0',
`optime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`operation` varchar(255) NOT NULL DEFAULT '',
`detail` varchar(255) NOT NULL DEFAULT '',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM
CREATE TABLE `album` (
`bid` int(11) NOT NULL AUTO_INCREMENT,
`bcid` int(11) NOT NULL DEFAULT '0',
`bname` varchar(255) NOT NULL DEFAULT '',
`bsinger` varchar(255) NOT NULL DEFAULT '',
`publishdate` date NOT NULL DEFAULT '0000-00-00',
`bdescript` text NOT NULL,
`bpic` varchar(255) NOT NULL DEFAULT '',
`committime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`operator` int(11) NOT NULL DEFAULT '0',
`bstatus` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`bid`)
) TYPE=MyISAM
CREATE TABLE `company` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`cname` varchar(255) NOT NULL DEFAULT '',
`cdescript` text NOT NULL,
`cpic` varchar(255) NOT NULL DEFAULT '',
`curl` varchar(255) NOT NULL DEFAULT '',
`cstatus` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`cid`)
) TYPE=MyISAM
CREATE TABLE `experience` (
`eid` int(11) NOT NULL AUTO_INCREMENT,
`ename` varchar(255) NOT NULL DEFAULT '',
`esinger` varchar(255) NOT NULL DEFAULT '',
`edescript` text NOT NULL,
`file` varchar(255) NOT NULL DEFAULT '',
`addtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`etimes` int(11) NOT NULL DEFAULT '0',
`estatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`eid`)
) TYPE=MyISAM
CREATE TABLE `forecast` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`fname` varchar(255) NOT NULL DEFAULT '',
`fdescript` varchar(255) NOT NULL DEFAULT '',
`furl` varchar(255) NOT NULL DEFAULT '',
`starttime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`endtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`createtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`fstatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`fid`)
) TYPE=MyISAM
CREATE TABLE `lucky` (
`kid` int(11) NOT NULL AUTO_INCREMENT,
`kname` varchar(255) NOT NULL DEFAULT '',
`type` tinyint(4) NOT NULL DEFAULT '1',
`kurl` varchar(255) NOT NULL DEFAULT '',
`luckynum` int(11) NOT NULL DEFAULT '0',
`luckysent` int(11) NOT NULL DEFAULT '0',
`luckyord` text NOT NULL,
`kpic` varchar(255) NOT NULL DEFAULT '',
`kdescript` text NOT NULL,
`starttime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`endtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`provider` varchar(255) NOT NULL DEFAULT '',
`issuetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`kstatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`kid`)
) TYPE=MyISAM
CREATE TABLE `luckylog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`kgkid` int(11) NOT NULL DEFAULT '0',
`kgord` int(11) NOT NULL DEFAULT '0',
`kgppname` varchar(255) NOT NULL DEFAULT '',
`luckytime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM
CREATE TABLE `luckyuser` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`kukid` int(11) NOT NULL DEFAULT '0',
`kuord` int(11) NOT NULL DEFAULT '0',
`kuppname` varchar(50) NOT NULL DEFAULT '',
`name` varchar(20) NOT NULL DEFAULT '',
`address` varchar(200) NOT NULL DEFAULT '',
`email` varchar(40) NOT NULL DEFAULT '',
`postcode` varchar(6) NOT NULL DEFAULT '',
`phonenum` varchar(20) NOT NULL DEFAULT '',
`mphone` varchar(13) NOT NULL DEFAULT '',
`committime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`sent` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`uid`)
) TYPE=MyISAM
CREATE TABLE `singer` (
`sid` int(11) NOT NULL AUTO_INCREMENT,
`svid` int(11) NOT NULL DEFAULT '0',
`singer` varchar(255) NOT NULL DEFAULT '',
`sppname` varchar(25) NOT NULL DEFAULT '',
`spic` text NOT NULL,
`spiclink` varchar(255) NOT NULL DEFAULT '',
`spicsl` text NOT NULL,
`mv` varchar(255) NOT NULL DEFAULT '',
`total` int(11) NOT NULL DEFAULT '0',
`valid` int(11) NOT NULL DEFAULT '0',
`sord` tinyint(4) NOT NULL DEFAULT '0',
`sstatus` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`sid`)
) TYPE=MyISAM
CREATE TABLE `song` (
`oid` int(11) NOT NULL AUTO_INCREMENT,
`obid` int(11) NOT NULL DEFAULT '0',
`oname` varchar(255) NOT NULL DEFAULT '',
`osinger` varchar(255) NOT NULL DEFAULT '',
`search` int(1) NOT NULL DEFAULT '1',
`word` varchar(255) NOT NULL DEFAULT '',
`mp3url` varchar(255) NOT NULL DEFAULT '',
`ostatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`oid`)
) TYPE=MyISAM
CREATE TABLE `vote` (
`vid` int(11) NOT NULL AUTO_INCREMENT,
`vname` varchar(255) NOT NULL DEFAULT '',
`starttime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`endtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`singernum` int(11) NOT NULL DEFAULT '0',
`votedesc` varchar(100) NOT NULL DEFAULT '',
`vstatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`vid`)
) TYPE=MyISAM
CREATE TABLE `votelog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`vgvid` int(11) NOT NULL DEFAULT '0',
`vgsid` int(11) NOT NULL DEFAULT '0',
`vgppname` varchar(255) NOT NULL DEFAULT '',
`votetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM
/* http://mu.baidu.com/sql/music.sql
*/
CREATE DATABASE music;
USE music;
CREATE TABLE `admin` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`aname` varchar(255) NOT NULL DEFAULT '',
`pwd` varchar(40) NOT NULL DEFAULT '',
`createtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastlogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`logintimes` int(11) NOT NULL DEFAULT '0',
`operator` int(11) NOT NULL DEFAULT '0',
`level` int(1) NOT NULL DEFAULT '0',
`acid` int(11) NOT NULL DEFAULT '0',
`astatus` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`aid`)
) TYPE=MyISAM;
CREATE TABLE `adminlog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`agaid` int(11) NOT NULL DEFAULT '0',
`optime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`operation` varchar(255) NOT NULL DEFAULT '',
`detail` varchar(255) NOT NULL DEFAULT '',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM;
CREATE TABLE `album` (
`bid` int(11) NOT NULL AUTO_INCREMENT,
`bcid` int(11) NOT NULL DEFAULT '0',
`bname` varchar(255) NOT NULL DEFAULT '',
`bsinger` varchar(255) NOT NULL DEFAULT '',
`publishdate` date NOT NULL DEFAULT '0000-00-00',
`bdescript` text NOT NULL,
`bpic` varchar(255) NOT NULL DEFAULT '',
`committime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`operator` int(11) NOT NULL DEFAULT '0',
`bstatus` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`bid`)
) TYPE=MyISAM;
CREATE TABLE `company` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`cname` varchar(255) NOT NULL DEFAULT '',
`cdescript` text NOT NULL,
`cpic` varchar(255) NOT NULL DEFAULT '',
`curl` varchar(255) NOT NULL DEFAULT '',
`cstatus` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`cid`)
) TYPE=MyISAM;
CREATE TABLE `experience` (
`eid` int(11) NOT NULL AUTO_INCREMENT,
`ename` varchar(255) NOT NULL DEFAULT '',
`esinger` varchar(255) NOT NULL DEFAULT '',
`edescript` text NOT NULL,
`file` varchar(255) NOT NULL DEFAULT '',
`addtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`etimes` int(11) NOT NULL DEFAULT '0',
`estatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`eid`)
) TYPE=MyISAM;
CREATE TABLE `lucky` (
`kid` int(11) NOT NULL AUTO_INCREMENT,
`kname` varchar(255) NOT NULL DEFAULT '',
`type` tinyint(4) NOT NULL DEFAULT '1',
`kurl` varchar(255) NOT NULL DEFAULT '',
`luckynum` int(11) NOT NULL DEFAULT '0',
`luckyord` text NOT NULL,
`kpic` varchar(255) NOT NULL DEFAULT '',
`kdescript` text NOT NULL,
`starttime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`endtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`provider` varchar(255) NOT NULL DEFAULT '',
`issuetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`kstatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`kid`)
) TYPE=MyISAM;
CREATE TABLE `luckylog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`kgkid` int(11) NOT NULL DEFAULT '0',
`kgord` int(11) NOT NULL DEFAULT '0',
`kgppname` varchar(255) NOT NULL DEFAULT '',
`luckytime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM;
CREATE TABLE `luckyuser` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`kukid` int(11) NOT NULL DEFAULT '0',
`kuord` int(11) NOT NULL DEFAULT '0',
`name` varchar(20) NOT NULL DEFAULT '',
`address` varchar(200) NOT NULL DEFAULT '',
`email` varchar(40) NOT NULL DEFAULT '',
`postcode` varchar(6) NOT NULL DEFAULT '',
`phonenum` varchar(20) NOT NULL DEFAULT '',
`mphone` varchar(13) NOT NULL DEFAULT '',
`committime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`uid`)
) TYPE=MyISAM;
CREATE TABLE `singer` (
`sid` int(11) NOT NULL AUTO_INCREMENT,
`svid` int(11) NOT NULL DEFAULT '0',
`singer` varchar(255) NOT NULL DEFAULT '',
`sppname` varchar(25) NOT NULL DEFAULT '',
`spic` text NOT NULL,
`total` int(11) NOT NULL DEFAULT '0',
`valid` int(11) NOT NULL DEFAULT '0',
`sord` tinyint(4) NOT NULL DEFAULT '0',
`sstatus` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`sid`)
) TYPE=MyISAM;
CREATE TABLE `song` (
`oid` int(11) NOT NULL AUTO_INCREMENT,
`obid` int(11) NOT NULL DEFAULT '0',
`oname` varchar(255) NOT NULL DEFAULT '',
`osinger` varchar(255) NOT NULL DEFAULT '',
`search` int(1) NOT NULL DEFAULT '1',
`word` varchar(255) NOT NULL DEFAULT '',
`mp3url` varchar(255) NOT NULL DEFAULT '',
`ostatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`oid`)
) TYPE=MyISAM;
CREATE TABLE `vote` (
`vid` int(11) NOT NULL AUTO_INCREMENT,
`vname` varchar(255) NOT NULL DEFAULT '',
`starttime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`endtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`vstatus` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`vid`)
) TYPE=MyISAM;
CREATE TABLE `votelog` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`vgvid` int(11) NOT NULL DEFAULT '0',
`vgsid` int(11) NOT NULL DEFAULT '0',
`vgppname` varchar(255) NOT NULL DEFAULT '',
`votetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`)
) TYPE=MyISAM;
INSERT INTO admin SET aname='admin', pwd='Baidu_music_man@ge', level=9;
/* http://mu.baidu.com/sql/update.sql
*/
ALTER TABLE lucky ADD luckysent int DEFAULT 0 NOT NULL AFTER luckynum;
ALTER TABLE luckyuser ADD kuppname varchar(50) DEFAULT '' NOT NULL AFTER kuord;
ALTER TABLE vote ADD singernum int DEFAULT 0 NOT NULL AFTER endtime;
ALTER TABLE vote ADD votedesc varchar(100) DEFAULT '' NOT NULL AFTER singernum;
ALTER TABLE singer ADD spiclink varchar(255) DEFAULT '' NOT NULL AFTER spic;
#backupdatabase.jx.sh
#!/bin/sh
MYSQL_BIN=~/local/mysql/bin/mysql
MYSQLDUMP_BIN=~/local/mysql/bin/mysqldump
YEAR=`date -d '1 days ago' +%Y`
MON=`date -d '1 days ago' +%m`
DAY=`date -d '1 days ago' +%d`
DATE=${YEAR}${MON}${DAY}
HOST=`hostname`
REMOTE_SERVER=10.23.65.18 #zjm-music0.zjm
EMAIL='yejiaming@baidu.com'
MOBILE='13911618190'
BACKUP_ROOT=~/backup/music
DATABASE_BACKUP_ROOT=${BACKUP_ROOT}/database
cd ${DATABASE_BACKUP_ROOT}
mkdir ${YEAR}
cd ${YEAR}
mkdir ${MON}
cd ${MON}
MUSIC_DATABASE_NAME=mu-sl
DIR=`pwd`
MUSIC_DATA_FILE=${MUSIC_DATABASE_NAME}.database.${DATE}
MUSIC_DATA_TAR=${MUSIC_DATA_FILE}.tar.gz
MUSIC_DATA_TAR_PATH=${DIR}/${MUSIC_DATA_TAR}
# 重试次数
MAX_WAIT_TIMES=60
# 等待时间间隔,单位为秒
WAIT_TIME=60
# 重试次数记数器
COUNTER=0
# 下载指数数据成功标志
SUCC=no
SAME=no
# START RUN ####################################################
rm -f ${MUSIC_DATA_FILE}*
# 数据下载
while [ $SUCC = no ]
do
COUNTER=`expr $COUNTER + 1`
if [ $COUNTER -gt $MAX_WAIT_TIMES ]
then
break
fi
scp ${REMOTE_SERVER}:${MUSIC_DATA_TAR_PATH} ./${MUSIC_DATA_TAR}
if [ ! -r ${MUSIC_DATA_TAR} ]
then
sleep $WAIT_TIME
else
while [ $SAME = no ]
do
sleep 10
scp ${REMOTE_SERVER}:${MUSIC_DATA_TAR_PATH} ./${MUSIC_DATA_TAR}.1
diff ${MUSIC_DATA_TAR}* >${MUSIC_DATA_TAR}.diff 2>&1
if [ -s ${MUSIC_DATA_TAR}.diff ]
then
cp ${MUSIC_DATA_TAR}.1 ${MUSIC_DATA_TAR}
rm -f ${MUSIC_DATA_TAR}.1
else
rm -f ${MUSIC_DATA_TAR}.1
SUCC=yes
SAME=yes
fi
rm -f ${MUSIC_DATA_TAR}.diff
done
fi
done
sleep 2
# 如果成功下载则导入数据,否则发报警
if [ ! -r ${MUSIC_DATA_TAR} ]
then
echo "$HOST: 获取${REMOTE_SERVER}:${MUSIC_DADA_FILE}失败! " | mail $EMAIL -s "$HOST: 获取${REMOTE_SERVER}:${MUSIC_DATA_FILE}失败!"
# for MBLID in $MOBILE
# do
# /home/work/bin/gsmsend -s 10.11.0.231:15000 $MBLID@"$HOST: 获取${REMOTE_SERVER}:${MUSIC_DATA_FILE}失败!"
# done
else
tar zxvf ${MUSIC_DATA_TAR}
${MYSQL_BIN} -uroot -f ${MUSIC_DATABASE_NAME} <${MUSIC_DATA_FILE}
rm -f ${MUSIC_DATA_FILE}
fi
#backupdatabase.sh
#!/bin/sh
MYSQL_BIN=~/local/mysql/bin/mysql
MYSQLDUMP_BIN=~/local/mysql/bin/mysqldump
YEAR=`date -d '1 days ago' +%Y`
MON=`date -d '1 days ago' +%m`
DAY=`date -d '1 days ago' +%d`
DATE=${YEAR}${MON}${DAY}
HOST=`hostname`
REMOTE_SERVER=10.23.65.18 #zjm-music0.zjm
EMAIL='yejiaming@baidu.com'
MOBILE='13911618190'
BACKUP_ROOT=~/backup/music
DATABASE_BACKUP_ROOT=${BACKUP_ROOT}/database
cd ${DATABASE_BACKUP_ROOT}
mkdir ${YEAR}
cd ${YEAR}
mkdir ${MON}
cd ${MON}
MUSIC_DATABASE_NAME=mu-sl
DIR=`pwd`
MUSIC_DATA_FILE=${MUSIC_DATABASE_NAME}.database.${DATE}
MUSIC_DATA_PATH=${DIR}/${MUSIC_DATA_FILE}
${MYSQLDUMP_BIN} -uroot --add-drop-table ${MUSIC_DATABASE_NAME} >${MUSIC_DATA_FILE}
sleep 2
tar zcvf ${MUSIC_DATA_FILE}.tar.gz ${MUSIC_DATA_FILE}
sleep 2
rm -f ${MUSIC_DATA_FILE}
#backupdatabase.zjm.sh
#!/bin/sh
MYSQL_BIN=~/local/mysql/bin/mysql
MYSQLDUMP_BIN=~/local/mysql/bin/mysqldump
YEAR=`date -d '1 days ago' +%Y`
MON=`date -d '1 days ago' +%m`
DAY=`date -d '1 days ago' +%d`
DATE=${YEAR}${MON}${DAY}
HOST=`hostname`
REMOTE_SERVER=10.23.65.18 #zjm-music0.zjm
EMAIL='yejiaming@baidu.com'
MOBILE='13911618190'
BACKUP_ROOT=~/backup/music
DATABASE_BACKUP_ROOT=${BACKUP_ROOT}/database
cd ${DATABASE_BACKUP_ROOT}
mkdir ${YEAR}
cd ${YEAR}
mkdir ${MON}
cd ${MON}
MUSIC_DATABASE_NAME=mu-sl
DIR=`pwd`
MUSIC_DATA_FILE=${MUSIC_DATABASE_NAME}.database.${DATE}
MUSIC_DATA_PATH=${DIR}/${MUSIC_DATA_FILE}
${MYSQLDUMP_BIN} -uroot --add-drop-table ${MUSIC_DATABASE_NAME} >${MUSIC_DATA_FILE}
sleep 2
tar zcvf ${MUSIC_DATA_FILE}.tar.gz ${MUSIC_DATA_FILE}
sleep 2
rm -f ${MUSIC_DATA_FILE}
#daily.sh
#!/bin/sh
SH_BIN="sh -x"
PHP_BIN=~/local/php/bin/php
MUSIC_ROOT=~/web/mu-sl
MUSIC_BIN=${MUSIC_ROOT}/bin
MUSIC_TOOLS=${MUSIC_ROOT}/tools
cd $MUSIC_TOOLS
$PHP_BIN exportstatdata.php
sleep 5
cd $MUSIC_BIN
${SH_BIN} backupdatabase.sh
sleep 5
${SH_BIN} musicstat.sh
sleep 5
#musicstat.sh
#!/bin/sh
LOGDIR=/home/work/backup/music/logs
YEAR=`date -d '5 days ago' +%Y`
MON=`date -d '5 days ago' +%m`
DAY=`date -d '5 days ago' +%d`
DATE=${YEAR}${MON}${DAY}
cd ${LOGDIR}/${YEAR}/${MON}
LOGFILE=mu-zone-access_log.${DATE}
HOSTNAME=`hostname | cut -f1 -d-`
RECEIVER='lina@baidu.com, guoyi@baidu.com, chenyan@baidu.com, yejiaming@baidu.com'
awk -F "\"" '{print $2" "$4}' ${LOGFILE} | awk -F " " '{print $2" "$4}' | grep -P "(\.php.*|^\/|\/main\/) " | sort -k 1,2 | uniq -c | sort -k 1 -n -r | mail $RECEIVER -s mu-zone.stat.${DATE}.${HOSTNAME}
#sysnchronize.sh
#!/bin/sh
date
MUSICROOT=~/web/mu-sl
UPLOADDIR=${MUSICROOT}/upload
REMOTEHOST='10.65.14.248 10.23.65.18'
LOCAL=10.23.65.18
cd $MUSICROOT
for host in $REMOTEHOST
do
if [ $LOCAL = $host ]
then
continue;
else
scp -r upload work@${host}:web/music/
fi
done
评论