It may be better to handle it at the time when the user is deleted.

Simplist thing would be to have the delete script (which is probably running as 
nobody) write to a file.  And then setup a cron job
to process that file, and see what directories need to be removed.



                                                      .~.
                                                      /v\
--                                                   // \\
JA                                                  /(   )\
                                                     ^`~`^
                                                   L I N U X
[-----------------------------------------------------------]
 Justin Ainsworth                      Systems Administrator
 PHONE: (530) 879-5660x108                    Sunset Net LLC
 FAX:   (530) 879-5676                     1915 Mangrove Ave
 WEB:   http://www.sunset.net                Chico, CA 95926   
 EMAIL: [EMAIL PROTECTED]         
[-----------------------------------------------------------] 

> -----Original Message-----
> From: Roger Thomas [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 13, 2003 8:23 PM
> To: [EMAIL PROTECTED]
> Subject: deleting maildirs/username
> 
> 
> i am running qmail-ldap with courier and php with horde's imp 
> as the webmail frontend.
> 
> i have a situation where i need to delete a user account once 
> he resigns from the company. it involves two operations:
> a) delete user account in ldap database
> b) delete user directory in /var/qmail/maildirs/username
> 
> part a) is ok which i accomplished with a simple php script. 
> however part b) poses a problem, which i need help here.
> 
> i am thinking of doing part b) by inserting extra commands in 
> custom_dirmaker shell script. the script will check for the 
> existence of ~/username. if exists, then it will delete it 
> first, b4 creating a new one. BUT, it does *not* work.
> 
> can sombody help me to troubleshoot the script below.
> nb: i have tested it from the command prompt and it works fine.
> 
> ---- custom_dirmaker ----
> #!/bin/sh
> if [ -d $1 ]
> then
>   /bin/rm -rf $1
>   logger "$1 exists, so I delete the whole directory"
> fi
> #Then we create $1
> logger "Creating Maildir/ for $1"
> mkdir -m 700 -p $1
> -------------------------
> 
> --
> roger
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online 
http://webhosting.yahoo.com


Reply via email to