Plan 9 from Bell Labs’s /usr/web/sources/contrib/someone/root/rc/bin/movemail

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
rfork ne
9fs fs
rm /srv/emelie
9fs emelie

switch($#*){
case 1
	user=$1
}
old=/n/emelie/mail/box/$user
new=/n/fs/mail/box/$user

PROTO=/tmp/movemail.$pid.$user
cat > $PROTO << EOF
mail
	box
		$user
			+
EOF

echo Getting all your mailbox files into the cache.
echo This could take a while, but we do this first to
echo shorten the time your mailbox is locked during the
echo copy.
{
	disk/mkfs -a -s /n/emelie $PROTO > /dev/null
}
echo
echo Caching done!
echo

unmount /mail/box
mail -c

echo Copying your mailbox files from $old to $new.
echo Your mailbox will be locked until this finishes.
echo Ignore the message about L.mbox...
echo
upas/lockmailbox
{
	rm $new/mbox
	disk/mkfs -a -s /n/emelie $PROTO | disk/mkext -d /n/fs
}
echo
echo Copying done!

kill lockmailbox | rc
rm $PROTO

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.