Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道将当前日期/时间插入 ssmtp 发送的电子邮件主题行的语法。
每当系统重新启动时,我都有一个 cronjob 通过电子邮件发送我的系统日志的尾部。
这是cronjob:
@reboot 尾 -1000 /var/log/syslog | mail -s "系统重新启动,这是系统日志" address@gmail.com &> /dev/null
是否有将系统日期插入主题行字段的简单方法?我还没有找到添加它的方法。
$(date)您应该能够通过插入主题行字符串来使其打印当前日期和时间。
$(date)
尝试:
@reboot 尾 -1000 /var/log/syslog | mail -s "$(date): 系统重新启动,这是系统日志" address@gmail.com &> /dev/null