[问题]让conky发音[已解决]
- ubuntu_lover
- 帖子: 119
- 注册时间: 2007-10-07 11:40
[问题]让conky发音[已解决]
我已经使用一个脚本让conky能够检测我的gmail邮箱,每半个小时查看一次有没有未读邮件。现在我想在检测到有未读邮件的时候发出声音提醒。请问这个功能能用shell实现吗?请指教一二。
上次由 ubuntu_lover 在 2008-04-05 16:39,总共编辑 1 次。
-
- 帖子: 1331
- 注册时间: 2006-07-09 12:22
- 来自: 南京
- ubuntu_lover
- 帖子: 119
- 注册时间: 2007-10-07 11:40
我的chek-gmail的脚本是这样的:
#!/bin/bash
gmail_login="username"
gmail_password="password"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password ... /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
能不能在里面综合进去发声的脚本 然后每半个小时检测 有的话就发声了
这个脚本是在网上找的 我不太会写脚本
#!/bin/bash
gmail_login="username"
gmail_password="password"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password ... /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
能不能在里面综合进去发声的脚本 然后每半个小时检测 有的话就发声了
这个脚本是在网上找的 我不太会写脚本
-
- 帖子: 1331
- 注册时间: 2006-07-09 12:22
- 来自: 南京
把脚本放到$PATH中,conkyrc加入一段:
脚本改为(要发声,play命令得先装sox包):
代码: 全选
${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
- ubuntu_lover
- 帖子: 119
- 注册时间: 2007-10-07 11:40
谢谢aBiNg的指点,我搞定了!装了sox,然后这样修改的脚本
代码: 全选
#!/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]
- solcomo
- 帖子: 2838
- 注册时间: 2007-04-25 13:12
- A-yu
- 帖子: 127
- 注册时间: 2008-04-25 23:45
Re: [问题]让conky发音[已解决]
六楼代码有点小错误,贴上个修改的……
代码: 全选
#!/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