Script To Backup Email
I was looking at a script I inherited from the previous admin that works quite nice. It is a basic bash script that that deletes the user from mail groups (mailman) and also backs up their current email into a nice tarball and then removes their mail / shell account from the email server.
Now the script moves the backup tarball to a directory called /var/backup and I will show what I see... Code:
[root@mail /]# cd /var/backup/ Code:
[root@mail backup]# rm -01-25-2007_10-44.tar.gz |
From what i see in your command, you are trying to pass the parameter "-01-25-2007_10-44.tar.gz" to rm which of course does not exist.
Try: [root@mail backup]# rm -i *-01-25-2007_10-44.tar.gz The -i makes the command interactive, always good while you are root and the * makes the wildcard select everything before the -01-25-2007_10-44.tar.gz You can also try either quotes "" or the back ticks ` to isolate the file name. Good luck! |
I have no idea why I can't remove this file...
Code:
[root@mail backup]# rm -i *-01-25-2007_10-44.tar.gz Code:
[root@mail backup]# file -01-25-2007_10-44.tar.gz |
Ok first of all, never answer questions before the first cup of coffee. My first answer will not work.
Lets find the inode number of the file. [root@mail backup]# ls -li 655428 -rw-r--r-- 1 root root 6537216 Jan 25 2007 -01-25-2007_10-44.tar.gz now let remove the inode [root@mail backup]# find . -inum 655428 -exec rm -i {} \; Where the inode number is the first number reported from ls. Thanks for the morning challenge. |
Now that the coffee is kicking in...
After you have cleaned up the file, you should modify your backup script and replace the dash "-" with an underscore "_" between your user's name and the date. This will help prevent similar problems in the future. Back to work now! |
Thanks !!!
That worked! |
All times are GMT -5. The time now is 01:55 AM. |