I'd like to know the syntax for inserting the current date/time into the subject line of an email sent by ssmtp.
I've got a cronjob emailing the tail of my syslog whenever the system reboots.
Here is the the cronjob:
@reboot tail -1000 /var/log/syslog | mail -s "the system rebooted, here's the syslog" [email protected] &> /dev/null
Is there a simple way of inserting the system date into the subject line field? I haven't found a way to add it.
You should be able to make it print the current date and time by inserting $(date)
into your subject line string.
Try:
@reboot tail -1000 /var/log/syslog | mail -s "$(date): the system rebooted, here's the syslog" [email protected] &> /dev/null