Add script 'restart-postfwd.sh'.
This commit is contained in:
parent
033c95c9ce
commit
a80402529f
19
restart-postfwd.sh
Executable file
19
restart-postfwd.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
trim() {
|
||||
local var="$*"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
echo -n "$var"
|
||||
}
|
||||
|
||||
PID="$(ps -A -o pid,cmd | grep /usr/sbin/postfwd | grep -v grep | head -n 1 | awk '{print $1}')"
|
||||
|
||||
if [[ -n "$(trim "$PID")" ]] ; then
|
||||
kill $PID
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
systemctl restart postfwd
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user