[问题]让conky发音[已解决]
发表于 : 2008-04-04 11:14
我已经使用一个脚本让conky能够检测我的gmail邮箱,每半个小时查看一次有没有未读邮件。现在我想在检测到有未读邮件的时候发出声音提醒。请问这个功能能用shell实现吗?请指教一二。
代码: 全选
${execi 1800 gmail_notify}
代码: 全选
[21:55@~/script] $ more gmail_notify
代码: 全选
#!/bin/bash
# name : gmail_notify
login="x"
passwd="XX"
inbox=`wget -T 3 -t 1 -q --secure-protocol=TLSv1 --no-check-certificate \
--user=$login --password=$passwd \
https://mail.google.com/mail/feed/atom -O - | \
sed -ne '/fullcount/s:.*>\([0-9]\+\)<.*:\1:p' 2> \
/dev/null`
if [ ! x$inbox == x'' ]
then
if [ ! $inbox -eq 0 ]
then
echo "$inbox new mail(s) in your box."
Xdialog --title "gmail messenger" --msgbox "please check the mail(s)." 5 40 &
# play *.mp3 > /dev/null 2>&1 &
else
echo "no new mails found!"
fi
else
echo "something error!"
fi
代码: 全选
#!/bin/bash
gmail_login="username"
gmail_password="password"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$dane" ]; then
echo "Connection Error !"
else
echo "GMail: $dane list(Inbox)"
fi
if [ "$dane" -gt 0 ]; then
cd /路径
play ×.mp3
fi]
代码: 全选
#!/bin/bash
gmail_login="用户名"
gmail_password="密码"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$dane" ]; then
echo "连接到Gmail服务器失败 !"
else
if [ "$dane" -gt 0 ]; then
cd /路径
play x.mp3
echo "GMail: 您有 $dane 封新的邮件 ^^"
else
echo "GMail: 没有收到新的邮件 ^-^"
fi
fi