Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: tim tanner on August 24, 2001, 08:24:50 PM
-
How do you edit or manage multiple pseudonyms e. g. delete them - where is that file on the server?
-
Use e-smith-manager
there can you add and delete pseudunyms..
-
I know but - how to delete 100 pseudonyms at once!?
-
From the root login (ie, in bash shell)...
Assuming you have the psuedonym 'myalias', the command you want to use to delete it is:
/sbin/e-smith/signal-event pseudonym-delete myalias
To delete a bunch of 'em, put a list of the names in a text file like this:
myalias1
myalias2
myaliasX
Then use this command (assuming the above file was named 'myaliases'):
for pseudonym in $(cat myaliases)
do
/sbin/e-smith/signal-event pseudonym-delete $pseudonym
done
For the curious, the reverse (adding a bunch of pseudonyms) goes like this. Create the file with the pseudonym and the account names separated by a colon, one pair per each line:
myalias1:account1
myalias2:account2
myalias3:account3
Now use this command (again, file name is 'myaliases'):
for pseudonym in $(cat myaliases)
do
OLDIFS="$IFS"
IFS=":$IFS"
/sbin/e-smith/signal-event pseudonym-create $pseudonym
IFS="$OLDIFS"
done
Why does this work? By resetting the internal field separator (IFS) for the bash shell to include a colon, the $pseudonym parameter is expanded into two words before being passed to signal-event. We don't set this outside the loop, otherwise the 'for' command would be parsing for the colon, too -- we don't want that.
BTW, you cannot simply delete the pseudonym records from the accounts file (either with the db command or via direct edits) as this would not properly update the email settings associated with the pseudonym. This is why signal-event is used. (Just make sure you have all of your spelling correct!)
HTH
Scott
-
Thanks Scott,
just what I've been asking for! - NICE!!!
-
You're most welcome!