OSCHINA数据通知提醒

2014-12-19 0 781
OSCHINA数据通知提醒
#!/bin/bash

USERNAME="wxg4net@gmail.com"
PWD="xxxxxxxxxxxxx"
API_LOGIN_VALIDATE="http://www.oschina.net/action/api/login_validate"
API_USER_NOTICE="http://www.oschina.net/action/api/user_notice"

DATA_LOGIN=$(curl -d "username="$USERNAME"&pwd="$PWD"&keep_login=1" -c /tmp/osc.cookie  $API_LOGIN_VALIDATE 2>&1)
DATA_OSC_UID=$(echo "$DATA_LOGIN" | grep '<uid' | cut -f2 -d">"|cut -f1 -d"<")
DATA_USER_NOTICE=$(curl -d "uid=$DATA_OSC_UID" -b /tmp/osc.cookie  $API_USER_NOTICE 2>&1)

atmeCount=$(echo "$DATA_USER_NOTICE" | grep '<atmeCount' | cut -f2 -d">"|cut -f1 -d"<")
msgCount=$(echo "$DATA_USER_NOTICE" | grep '<msgCount' | cut -f2 -d">"|cut -f1 -d"<")
reviewCount=$(echo "$DATA_USER_NOTICE" | grep '<reviewCount' | cut -f2 -d">"|cut -f1 -d"<")
newFansCount=$(echo "$DATA_USER_NOTICE" | grep '<newFansCount' | cut -f2 -d">"|cut -f1 -d"<")

if [ $atmeCount != "0" ] ||  [ $msgCount != "0" ]   ||  [ $reviewCount != "0" ]   ||  [ $newFansCount != "0" ] 
then
   notify-send  "OSChina通知" "数据:$atmeCount / $msgCount / $reviewCount / $newFansCount" 
fi

遇见资源网 shell OSCHINA数据通知提醒 http://www.ox520.com/16754.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务