Subject: Problem with mkdir if directory already created
To: NetBSD Help <netbsd-help@netbsd.org>
From: Chris Ewert <chris@infolaunch.com>
List: netbsd-help
Date: 06/18/1999 10:06:00
I ran accross an interesting problem.  I wrote a script to easily add
user to my server (create directories, chown, chgrp and chmod them
properly.  I also included something to automatically edit the quota,
group file, ect.  If I run this script once correctly it works
perfectly.  However if I have already run the thing once before it
causes a panic 100% of the time.  Any ideas on what would cause that?  I
know I can write something to check to see if the directories already
exist, but I thought mabe this was a bug of some type.  Here is the
script:

username="username"

vipw
passwd $username

mkdir "/home/users/$username"
chmod 755 "/home/users/$username"
chown "$username" "/home/users/$username"
chgrp users "/home/users/$username"

mkdir "/home/real/pub/$username"
chmod 755 "/home/real/pub/$username"
chown "$username" "/home/real/pub/$username"
chgrp users "/home/real/pub/$username"

mkdir "/home/ftpdir/pub/$username"
chmod 755 "/home/ftpdir/pub/$username"
chown "$username" "/home/ftpdir/pub/$username"
chgrp users "/home/ftpdir/pub/$username"

mkdir "/home/users/$username/public_html"
chmod 755 "/home/users/$username/public_html"
chown "$username" "/home/users/$username/public_html"
chgrp users "/home/users/$username/public_html"
ln -s "/home/ftpdir/pub/$username/"
"/home/users/$username/ftp_directory"
ln -s "/home/real/pub/$username/" "/home/users/$username/real_media"
cp /home/new/.cshrc "/home/users/$username/.cshrc"
vi /etc/group
edquota $newuser

--
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.

Chris Ewert   chris@infolaunch.com

.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.

Is your ISP not providing what you need?
Need Web Space?  Want a web page?
Visit InfoLaunch Internet Services:

http://www.infolaunch.com

No Banners or PopUps required
Anonymous FTP and Real Audio supported

.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.