Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the at command to send mail regularly in Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people don't know what to do about how to use the at command to send emails regularly in Linux. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

The Linux at command can run a program at a certain time, while mail can send and copy the body of the message stored in a text on the command line.

The specific usage of the Linux at command to send mail on a regular basis:

1. Get the email text ready, for example, in email.txt

two。 Then write a script, such as run.sh

#! / usr/bin/bash

Mail-s "Title here"-c Address_CC Address_To

< email.txt 3. 命令行里执行 at 0815am Jan 24 at>

. / run.sh

At > ^ D

Run.sh can be executed in 8:15am, Jan 24.

However, some servers restrict the use of the at command, so there is another stupid way

Add "speep time" at the beginning of run.sh, then run run.sh directly, and then go to the background.

Time here is an integer, which means how many seconds.

However, some servers will make the user logout automatically when the terminal does not enter for a period of time, so you can make some actions such as pwd,ls in the script from time to time to prevent this situation.

After reading the above, have you mastered how to use the at command to send emails regularly in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report