Website backup task

我会在每个月最后一天备份网站,如果最后一天是周五或者周末,那么就在这一周的周四备份。由于记性不大好,所以需要有个提醒。之前一直用RTM,可惜我这个规则有点复杂,没法在RTM里面描述,导致经常要修改任务日期,有点麻烦。有时候稍不留神就错过了。

今天终于无法忍受,改用Org Mode了。方法就是使用一个超眩的任务日期,如下:

** DONE 备份网站
   SCHEDULED: <%%(wl-diary-website-backup-day)>

wl-diary-website-backup-day的实现如下:

(defun wl-diary-website-backup-day (&optional mark)
  (let* ((day (calendar-extract-day date))
         (month (calendar-extract-month date))
         (year (calendar-extract-year date))
         (lastday (calendar-last-day-of-month month year))
         (lastdayname (calendar-day-of-week (list month lastday year))))
    (and (or (and (= day lastday)
                  (memq lastdayname '(1 2 3 4)))
             (and (< (- lastday day) 7)
                  (memq lastdayname '(0 5 6))
                  (= (calendar-day-of-week date) 4)))
         (cons mark ""))))

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据