From 6016eb13bef1c9c3bb9c8d0640e1b54e1bbc6f72 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 7 Oct 2016 11:15:13 +0200 Subject: [PATCH] update command line --- commands/exim_forwardadd.sh | 3 ++- commands/exim_forwarddel.sh | 4 +++- commands/exim_forwardlist.sh | 7 +++++++ commands/exim_userdel.sh | 4 +++- commands/exim_userlist.sh | 3 +++ 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 commands/exim_forwardlist.sh create mode 100644 commands/exim_userlist.sh diff --git a/commands/exim_forwardadd.sh b/commands/exim_forwardadd.sh index af5e32f..597ad93 100644 --- a/commands/exim_forwardadd.sh +++ b/commands/exim_forwardadd.sh @@ -5,4 +5,5 @@ read emailfrom echo "Forward TO email: " read emailto -echo "$(cat /etc/exim4/forward/$emailfrom)$emailto," > "/etc/exim4/forward/$emailfrom" +DIR=/etc/exim4/forward +echo "$(cat $DIR/$emailfrom)$emailto," > "$DIR/$emailfrom" diff --git a/commands/exim_forwarddel.sh b/commands/exim_forwarddel.sh index d88a94f..dc9f1eb 100644 --- a/commands/exim_forwarddel.sh +++ b/commands/exim_forwarddel.sh @@ -5,4 +5,6 @@ read emailfrom echo "Forward TO email: " read emailto -sed -i "s/$emailto,//g" "/etc/exim4/forward/$emailfrom" +DIR=/etc/exim4/forward +sed -i "s/$emailto,//g" "$DIR/$emailfrom" +[[ ! -s $DIR/$emailfrom ]] && rm -f $DIR/$emailfrom diff --git a/commands/exim_forwardlist.sh b/commands/exim_forwardlist.sh new file mode 100644 index 0000000..c45bb0b --- /dev/null +++ b/commands/exim_forwardlist.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +DIR=/etc/exim4/forward +for file in $DIR/* +do + echo "$file: $(cat $DIR/$file)" +done diff --git a/commands/exim_userdel.sh b/commands/exim_userdel.sh index 0a57aba..567d132 100644 --- a/commands/exim_userdel.sh +++ b/commands/exim_userdel.sh @@ -5,6 +5,8 @@ read username echo "Domain: " read domain -sed "/$username/d" "/etc/exim4/domains/$domain" +DIR=/etc/exim4/domains +sed -i "/$username/d" "$DIR/$domain" +[[ ! -s $DIR/$domain ]] && rm -f $DIR/$domain userdb "$username@$domain" del makeuserdb diff --git a/commands/exim_userlist.sh b/commands/exim_userlist.sh new file mode 100644 index 0000000..99d25eb --- /dev/null +++ b/commands/exim_userlist.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +userdb -show