I question the wisdom of keeping your todo list on a computer that may be sleeping for weeks or months at a time, but if you really want to do it, here's how. This will only report tasks that are due on the same date that the computer resumes. Let me know if it works or not.
If you want it to run on resume...
Give this a name, make it executable, and save it in etc/pm/sleep.d/
- Code: Select all
#!/bin/bash
case "$1" in
resume)
# executed on resume
/usr/bin/taskfer-notify
;;
*)
;;
esac
(If you want it to run every day, make a cron job to run taskfer-notify instead of making the above file in sleep.d.)
Create ~/.muttrc and put in your correct email address.
Then 'chmod 600 ~/.muttrc' so only you can read your password.
The smtp server shown below is correct for gmail. If you use other mail, find out what to use for the smtp server, and if it does not take an encrypted password, get rid of the ssl_force_tls line and change smtps:// to smtp:// (or better yet, change your email provider to one that does encrypt the password.)
- Code: Select all
set use_from = "yes"
set from = "golinux@nomail.com"
set smtp_url = "smtps://golinux:password@smtp.googlemail.com:465/"
set ssl_force_tls = "yes"
Edit /usr/bin/taskfer-notify - replace everthing from line 28 on with the following. Put your correct email address in the mutt line. The -s option is for the subject line, which you can edit to suit your tastes. Also, I'm not sure if the 'sleep 3' is necessary, but I figured it's a good idea to give mutt a chance to send the file before deleting it.
This will create one email message with the attached text file that has a line for each task due today.
- Code: Select all
ddt=$(date +%F)
if [[ $(type -p notify-send) ]] ; then
while read line ; do
if [[ -n $(echo $line | cut -d"|" -f2 | grep $ddt) ]] ; then
echo "$line" >> /tmp/mail.txt
fi
done < "$tasklist"
else
echo " You need to install the libnotify-bin package
for this function to work."
exit 1
fi
if [[ -f /tmp/mail.txt ]] ; then
notify-send -t 7000 "You have tasks listed for today. Check your todo list."
mutt -s "Today's Tasks" -a /tmp/mail.txt -- golinux@nomail.com < /dev/null
sleep 3
rm -f /tmp/mail.txt
fi
exit 0
@nadir: if you script the sshfs mount, add taskfer-notify to the end of the script. You might need to change the paths to the sourced files in the beginning of taskfer-notify.