当前位置:网站首页>crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理
crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理
2022-04-23 13:51:00 【数语数行】
在某台Linux系统中运行命令,按tab键补充输出时,提示“无法为立即文档创建临时文件:设备上没有空间”信息,如下所示:
检查文件系统的空间使用情况,输出正常:
检查文件系统的inode数量使用情况,根分区的inode已经全部耗尽:
使用命令“ls -lR /var |grep “^-”|wc -l”查看根目录下各个目录的文件数量,发现/var目录有大量的文件。
进一步检查,确认/var/spool/postfix/maildrop目录下有大量的小文件。
"mailq"命令显示有大量的root用户待发送邮件队列,“mail”输出中也有大量的信息。
进入/var/spool/postfix/maildrop目录,删除目录下所有文件。
# find ./ -type f | xargs rm -f
或
# find ./ -type f -exec rm -f {} ;
根目录的inode使用情况恢复正常,如下:
同时,也对root用户收到的所有邮件进行了清空:
# echo > /var/spool/mail/root
检查系统中的crontab定时任务列表,其中含有每分钟执行一次的脚本,但脚本后面没有加上“ > /dev/null 2>&1”或者“ > 日志路径和名称 2>&1”来丢弃或保留脚本的输出到日志文件。
系统在默认情况下,会将crontab定时任务执行的脚本的输出通过邮件发送给cron用户。但是由于用户接收的邮件数量或邮件占用的总空间大小有最大限制,因此发送不成功的邮件就不断在/var/spool/postfix/maildrop目录下堆积,最终导致文件系统中文件数量过多而耗尽文件系统的inode。
标准的定时任务配置建议在脚本后面加上前面所述的内容。
另外,也可以使用crontab -e更改用户的定时任务,在脚本的前面行中加上行MAILTO=“”,让cron进程不将脚本输出的内容通过邮件来发送(如果使用/etc/crontab文件来配置MAILTO参数的话,定时任务脚本应该也得放在该文件中才能生效),示例如下:
# crontab -l
MAILTO=“”
* * * * * script1.sh
版权声明
本文为[数语数行]所创,转载请带上原文链接,感谢
https://blog.csdn.net/jetliu05/article/details/124342527
边栏推荐
- [code analysis (7)] communication efficient learning of deep networks from decentralized data
- The query did not generate a result set exception resolution when the dolphin scheduler schedules the SQL task to create a table
- Oracle clear SQL cache
- The art of automation
- Oracle creates tablespaces and modifies user default tablespaces
- 第十五章 软件工程新技术
- Android interview theme collection
- Generate 32-bit UUID in Oracle
- Analysis of unused index columns caused by implicit conversion of timestamp
- SQL learning | set operation
猜你喜欢
ACFs file system creation, expansion, reduction and other configuration steps
SQL learning window function
Small case of web login (including verification code login)
[machine learning] Note 4. KNN + cross validation
Static interface method calls are not supported at language level '5'
Decentralized Collaborative Learning Framework for Next POI Recommendation
Express②(路由)
Dolphin scheduler source package Src tar. GZ decompression problem
Apache seatunnel 2.1.0 deployment and stepping on the pit
Zero copy technology
随机推荐
[VMware] address of VMware Tools
Set Jianyun x Feishu Shennuo to help the enterprise operation Department realize office automation
Utilisation de GDB
低频量化之明日涨停预测
Using Jupiter notebook in virtual environment
美联储数字货币最新进展
函数只执行第一次的执行一次 once函数
Es introduction learning notes
Zero copy technology
Window function row commonly used for fusion and de duplication_ number
[code analysis (3)] communication efficient learning of deep networks from decentralized data
联想拯救者Y9000X 2020
Ora-16047 of a DG environment: dgid mismatch between destination setting and target database troubleshooting and listening vncr features
Publish custom plug-ins to local server
Dolphin scheduler configuring dataX pit records
Express middleware ③ (custom Middleware)
Static interface method calls are not supported at language level '5'
零拷貝技術
SQL learning | set operation
Django::Did you install mysqlclient?