Linux timed sending mail-Linux Enterprise Application-Linux server application information. The following is a detailed description. Sometimes it is necessary to notify others or do something on their own at some time. For those who read emails every day, sending emails is the safest. In Linux, it is easy to use at with mail.
The at command can run a program at a certain time, while mail can send a copy of the mail body stored in a text in the command line.
Usage:
1. better understand the emailtext, such as in email.txt.
2. Then write a script, such as run. sh.
#! /Usr/bin/bash
Mail-s "Title here"-c Address_CC Address_To <email.txt
3. Execute
At 0815am Jan 24
At>./run. sh
At> ^ D
Run. sh can be executed at 8: 15 am, Jan 24.
However, some servers limit the use of the at command, so there is a stupid way,
Add "speep time" at the beginning of run. sh and run. sh directly.
Time is an integer in seconds.
However, some servers will automatically log out when the terminal does not enter a period of time, so that some actions such as pwd and ls in the script can be performed from time to prevent this situation.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service