5 # to be run on the mail server at onelab.eu, to add aliases in that domain
7 # new-alias.sh francois2.jan@orange-ftgroup.com
9 # francois2.jan@onelab.eu -> francois2.jan@orange-ftgroup.com
11 COMMAND=$(basename $0)
13 SQL="psql -U mail mail"
16 echo "Usage: $command alias1 [ .. aliasn]"
24 namepart=$(echo $target | cut -s -d @ -f 1)
25 domainpart=$(echo $target | cut -s -d @ -f 2)
26 if [ -z "$namepart" -o -z "$domainpart" ] ; then
27 echo "WARNING: $target skipped"
30 aliasname=${namepart}@onelab.eu
31 sqlcommand="insert into alias values ( '${aliasname}', '${target}' )"
32 echo "Sending $sqlcommand"
33 echo "$sqlcommand" | $SQL
37 function list_aliases () {
38 echo 'select * from alias;' | $SQL
46 if [[ -z "$targets" ]] ; then
49 for target in "$@" ; do