2篇 crontab related articles

premature EOF errors in crontab file

How to fix this: premature EOF errors in crontab file, can't install

  1. Check for Missing Newline Characters:

    Make sure each line in your crontab file ends with a newline character. The absence of a newline character can cause premature EOF errors.

  2. Check for Spaces at the End of Lines:

    Trailing spaces at the end of lines can also cause premature EOF errors. Ensure that there are no extra spaces after the command or arguments on each line.

  3. Fix Incorrect Syntax:

    Carefully review the syntax of your crontab entries. Double-check the format and ensure that all fields (minute, hour, day, month, weekday, and command) are present and in the correct order.

More ~

mac上定时提醒常喝水、多注意休息

Linux的定时功能crontab同样在macos上也可以用。

起因是之前检查过有尿结石,最近小腹疼,还尿出血,感觉又有结石了,所以还是要多喝水,所以写个定时提醒来时刻提醒自己。

先写段shell脚本来设置提醒内容
文件命令为 drink.sh

title="日常提醒"
content="常喝水,常排尿,远离疾病, 爱你的亲"
subtitle="记得喝水"
sound="Pon"
cmd=$(printf 'display notification "%s" with title "%s" subtitle "%s" sound name "%s"' "$content" "$title" "$subtitle" "$sound")
osascript -e "$cmd" 
say -v Ting-ting $content 
More ~