3 # to be run on the mail server at onelab.eu, to add aliases in that domain
5 # new-alias.sh francois2.jan@orange-ftgroup.com
7 # francois2.jan@onelab.eu -> francois2.jan@orange-ftgroup.com
11 SQL="psql -U mail mail"
14 echo "Usage: $command alias1 [ .. aliasn]"
22 namepart=$(echo $target | cut -s -d @ -f 1)
23 domainpart=$(echo $target | cut -s -d @ -f 2)
24 if [ -z "$namepart" -o -z "$domainpart" ] ; then
25 echo "WARNING: $target skipped"
28 aliasname=${namepart}@onelab.eu
29 sqlcommand="insert into alias values ( '${aliasname}', '${target}' )"
30 echo "Sending $sqlcommand"
31 echo "$sqlcommand" | $SQL
35 function list_aliases () {
36 echo 'select * from alias;' | $SQL
44 if [[ -z "$targets" ]] ; then
47 for target in "$@" ; do