I saw the following error message today on one of our nagios servers
when i tried to save a file in vim.
Cannot create backup file, (use ! to override)
The uptime of this server was about 300 days.
I checked the amount of files in /tmp
nagios:~# ls /tmp | wc -l
889578
i then tried to delete the files without any luck:
nagios:/tmp# rm cor*
-bash: /bin/rm: Argument list too long
The solution:
i created a small bash script (del.sh)
#!/bin/sh
for FILE in `ls`
do
rm $FILE
done
made it executable with
chmod +x del.sh
started the script
nagios:/tmp# ./del.sh
bye, bye:
nagios:/tmp# ls /tmp | wc -l
1
Time to restart nagios with
nagios:/tmp# /etc/init.d/nagios start
Starting nagios: done.