FreeBSD下remind的安装

FreeBSD下remind的安装

remind 是一款非常优秀的记事软件,它小巧却不失功能强大,凡是涉及时间表的事情都可以交给它来做。

下面我们将用它实现:开机时系统用语音或文字提醒今天要做的事情。步骤如下:

安装 remind

配置.reminders(我把这个文件放在/backup下,放在哪里无所谓,由用户自己定)如下:

###################################
# File: .reminders                #
# Reminder file for "remind"      #
#                                 #
# Usage:                          #
# vi /backup/.reminders           #
# chmod 644 .reminders            #
#                                 #
# To test:                        #
# remind -gaa /backup/.reminders  #
###################################
# Switch off the normal banner
BANNER Hello, IOU. Today is %w.

##########################
###### Things to do ######
##########################
REM Mon MSG The course of statistical machine learning.
REM Sat MSG The course of probability theory and mathematical statistics.
REM Sat MSG Meet the student.
REM     MSG The model of Bayesian kernel methods.

##################################
###### Sort the todo things ######
##################################
FSET sortbanner(x) iif(x == today(), "You have the following things to do.", "And, the other things %b.")

安装语音合成软件

安装 festival 和 festvox-kal16。或者 flite,它是 festival 的替代品,但体积小,效率高。

festival 是非常优秀的 text-to-speech(TTS)软件,爱丁堡大学的成果。 festvox-kal16 用的是 CMU 的词典(CMU 的语音合成和语音识别做的也特别好)。

配置 rc.conf

在/etc/rc.conf中加入

clear_tmp_enable="YES"

每次退出系统时清空 /tmp

脚本

在 /usr/local/etc/rc.d/ 中做脚本 VoiceRemind.sh,如下

#!/bin/sh
#/usr/local/etc/rc.d/VoiceRemind.sh
echo -n ‘ VoiceRemind’

case "$1" in
start)
  /usr/local/bin/remind -gaa /backup/.reminders > /tmp/.VoiceRemind
  ;;
stop)
  kill -9 `cat /var/run/remind.pid`
  ;;
*)
  echo "Usage: `basename $0` {start|stop}" >&2
  exit 64
  ;;
esac
exit 0

每次boot时,自动运行 remind 并将生成的显示存到 /tmp 下,这就是为啥要退出系统时清空 /tmp 了。当然,不这么做也行,毕竟“>”是创造新文件。不过清空 /tmp 也没啥坏处。 好了,试一下

remind /backup/.reminders | festival –tts

看是否好用。若有正确的语音提示,接着做下一步。否则,回头检查一下前面的步骤。

原文链接:http://wiki.freebsdchina.org/software/r/remind