05 12 * * * mailx -s "Daily email delivery test" email@example.com </home/jan/Documents/daily_mail_test_message.txt
The body of the message will contain the contents of the file
The first 5 elements on the line in the crontab file are scheduling elements:
# ┌───────────── min (0 - 59) # │ ┌────────────── hour (0 - 23) # │ │ ┌─────────────── day of month (1 - 31) # │ │ │ ┌──────────────── month (1 - 12) # │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to # │ │ │ │ │ Saturday, or use names; 7 is also Sunday) # │ │ │ │ │ # │ │ │ │ │ # * * * * * command to execute
If an asterisk is used for an element, that indicates that scheduling is done for every possible value for that element. E.g., the 05 on the line indicates five minutes after the hour, in this case 12 (noon) and the following three asterisks indicate that the cron job should be run every day of every month and every day of the week, i.e., Sunday to Saturday. Use 24-hour clock time values, aka "military time", for the hours, e.g. 5:00 PM is 17.
To create the cron entry you can use
crontab -e to edit the
crontab file for your
account - see the crontab
man page for information on usage of the command. Crontab will normally use the
editor. If you are unfamiliar with the editor, if you type
-e, when you enter the editor, you can hit the
to go to the end of the file, then hit the
a key to append
to the end of the file, then type or paste the appropriate line into the file.
Then hit the
Esc key to leave editing mode. Then hit the colon
:) key and type
wq to write out the update
file and quit the editor. If you make a mistake and don't want to save
your changes, type
q! after the colon. You can view the
current contents of the crontab file with
For the man page for the mailx command, see mailx.