set -o pipefail
processDate="$(date -d "$1 1 days ago" +'%Y%m%d')"
CONFIG_MYSQL_BIN='mysql -uroot -pyang0328 --default_character_set=utf8 --database=test -N -A'
QUERY_CONFIG="select concat_ws('####',id,ifnull(age,999),cup_size) from girl"
DB_RESULT="$(${CONFIG_MYSQL_BIN} <<< "${QUERY_CONFIG}")"
启动zookeeper集群
echo "start zkServer"
for i in 1 2 3
do
ssh mini0$i "source /etc/profile;/home/hadoop/zookeeper-3.4.8/bin/zkServer.sh start"
done
mysql
mysql -u$mysql_user -h$mysql_host -p"$mysql_password" -e "use business_analysis;delete from $table where date='$yyyymmdd';\
LOAD DATA LOCAL INFILE '$resultFile' into table $table FIELDS TERMINATED BY '\t';";
local_path="$(cd $(dirname $0);pwd)"
跳板机免密登录服务器
执行这个命令: echo 'eval `/usr/local/bin/ssh-attach`' >> ~/.bashrc && source ~/.bashrc
这时会要求输入passphrase,输入正确的passphrase
执行这个命令: ssh -add(注意:中间带有空格)
发送邮件命令:echo "$mailcontent" | mail -s "火车票新客引流到其他业务线的新客数据" -a $dir/cross_newuser.xlsx -c 抄送人1@qq.com -c 抄送人2@qq.com 收件人1@qq.com 收件人2@qq.com 收件人3@qq.com
检查邮件箱中是否有滞留邮件没发送/usr/lib/sendmail -bp
参考:https://www.cnblogs.com/toowang/p/3920465.html