Move and later delete mail data of nonexistant users.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Move and later delete mail data of nonexistant users.
# 1  
Old 10-30-2012
Move and later delete mail data of nonexistant users.

Hello everyone!
i hope u can help me...
i need a script that is able to do:
When a user gets deleted in the ldap DB, the mail folder remains.
How can i move to another location and delete it after a month?
Smilie
# 2  
Old 10-30-2012
Perhaps something like
Code:
cd /var/spool/mail
for MBX in *
do
   [[ -z $(getent passwd $MBX) ]] && mv $MBX /some/where/else
done

to move away orphaned mailbox files and later
Code:
find /some/where/else -mtime +30 | xargs rm

(untested, just to give you an idea).
This User Gave Thanks to hergp For This Post:
# 3  
Old 11-02-2012
Thank you hergp,
i will try to configure with your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Move directory with rsync and delete from source

I need a rsync command which will exclude certain files and directories from source and copy the rest. I got this command working, sudo rsync -avzh --exclude 'bin' --exclude 'braintree' --exclude 'colinmollenhour' --exclude 'composer' --exclude 'doctrine' --exclude 'fabpot' --exclude... (2 Replies)
Discussion started by: Siddheshk
2 Replies

2. Post Here to Contact Site Administrators and Moderators

Delete or move post to applescript area

i posted an applescript question in the wrong area, trying frantically to delete or move before I get in trouble for posting question in wrong area. it is the one about opening webpages and searching text with applescript, thanks (1 Reply)
Discussion started by: ilovedoritos
1 Replies

3. Shell Programming and Scripting

How to get users history as mail..

Hi all, Thanks in Advance, i want to view my users commands, what commands they are using in their terminal like that, how to automate this history process daily. (6 Replies)
Discussion started by: anishkumarv
6 Replies

4. Shell Programming and Scripting

Mail to a file of users

How can I send the same form email to multiple users, but with variances like their username, password, and login host or environment? At work we use vdi's which are extremely slow - especially opening Outlook to open a form letter saved on Sharepoint. I was wondering if I could put the users'... (2 Replies)
Discussion started by: MaindotC
2 Replies

5. Shell Programming and Scripting

Send e-mail to users

Dear all, The perl script to send e-mail is working in my current script. #This part of the script will send the email notification my $to='mohamed.rahman@noridian.com'; my $from='xyz@hotmail.com'; my $subject='POS_CODES_38 DATA LOADED SUCCESSFULLY.'; my $message='The total no. of files... (2 Replies)
Discussion started by: msrahman
2 Replies

6. Shell Programming and Scripting

Delete duplicate data and pertain the latest month data.

Hi I have a file with following records It contains three months of data, some data is duplicated,i need to access the latest data from the duplicate ones. for e.g; i have foll data "200","0","","11722","-63","","","","11722","JUL","09" "200","0","","11722","-63","","","","11722","JUL","09"... (10 Replies)
Discussion started by: vee_789
10 Replies

7. UNIX for Dummies Questions & Answers

Help with Promting users to move the script along:

Hi guys, Simple question really (only when you know how!) I would like to clear the screen between two parts of script. However I would like the user to be prompted if he/she has completed reading the output from the first part of the script before moving on. i.e = grep "$###" #####... (2 Replies)
Discussion started by: SDKC
2 Replies

8. UNIX for Dummies Questions & Answers

Move contents of a directory into one file for e-mail distribution ...

Hello, Here is what I am trying to accomplish. I am going to have one directory in which there will be files of varying types (Excel, Word, PPT, and possible others), and I need to be able to be bundle however many files there are in there together in to one file to be used as an e-mail... (3 Replies)
Discussion started by: rip73
3 Replies

9. Shell Programming and Scripting

Bash rsync but move not delete

There might be an easy solution to my problem, or maybe not, but here it is. I am trying to rsync a Volume with 1.5 terabytes of data and send it via fibre channel to a raid array. Now normally when I rsync it scans through everything and, before copying anything, deletes any files that have... (1 Reply)
Discussion started by: Movomito
1 Replies

10. Shell Programming and Scripting

delete and move number forward..in file

I have a file, can I just modify the <number> field and delete the 3rd number and move 4th number to 3rd.. (surely, delete the last digit)? <john> <Number>11 20 03 22 23 21 91 00 F0</Number> <peter> <Number>12 20 03 20 99 21 91 20 F0</Number> <ken> <id> <Number>10 21 03 21 78 21 92... (6 Replies)
Discussion started by: happyv
6 Replies
Login or Register to Ask a Question