【发布时间】:2018-09-03 17:58:53
【问题描述】:
我正在构建一个脚本,它可以帮助我每天在我的 CMS 上更新新内容时重新构建静态站点。出于测试目的,我正在本地计算机上试用。
名为helloworld.sh的脚本是
#!/bin/bash
(cd /Projects/blog && gatsby build)
我已将 crontab -e 编辑为
* * * * * /Projects/scripts/helloworld.sh
这让它每分钟运行一次,只是为了测试目的。但是,它不起作用并返回错误,未安装 MTA,在我运行服务 cron 状态时丢弃输出。我查了一下,它是关于邮件输出的,据说它根本不应该影响脚本的作用。
Apr 30 23:05:01 unicornfinder CRON[12363]: (unicornfinder) CMD (/Projects/scripts/helloworld.sh)
Apr 30 23:05:01 unicornfinder CRON[12362]: (CRON) info (No MTA installed, discarding output)
如何让这个脚本运行?谢谢!
【问题讨论】:
-
顺便说一句,shell脚本中的括号是多余的,效率低下。