hosts/scripts/main_part.include: only kill pd if prozess is present.
This commit is contained in:
@@ -18,7 +18,7 @@ backup_mirror_dir=$script_backup_dir/mirror
|
||||
script_dir=$hosts_base_dir/scripts
|
||||
|
||||
## - All backuped directories will be written to that file, to
|
||||
## - avoid multiple execution.
|
||||
## - avoid multiple execution.
|
||||
## -
|
||||
dirs_backup_done="$script_backup_dir/backup_dirs.lst"
|
||||
|
||||
@@ -30,13 +30,13 @@ export destHost script_backup_dir backup_archiv_dir backup_mirror_dir script_dir
|
||||
|
||||
## - Works even if "ssh_hopping" is not set
|
||||
## -
|
||||
if [ "X$ssh_hopping" = "X" ] ; then
|
||||
ssh_hopping=false
|
||||
if [ "X$ssh_hopping" = "X" ] ; then
|
||||
ssh_hopping=false
|
||||
fi
|
||||
## - Works even if "ssh_tunnel" is not set
|
||||
## -
|
||||
if [ "X$ssh_tunnel" = "X" ] ; then
|
||||
ssh_tunnel=false
|
||||
if [ "X$ssh_tunnel" = "X" ] ; then
|
||||
ssh_tunnel=false
|
||||
fi
|
||||
|
||||
if ! $ssh_hopping && ! $ssh_tunnel ; then
|
||||
@@ -69,7 +69,7 @@ else
|
||||
## - delete existing ssh tunnels
|
||||
## -
|
||||
tunnel_pid_old=`ps x | grep -e "$local_port:[^:]*:$target_port" | grep -v grep | awk '{print$1}'`
|
||||
|
||||
|
||||
if [ -n "$tunnel_pid_old" ]; then
|
||||
kill $tunnel_pid_old
|
||||
fi
|
||||
@@ -93,7 +93,7 @@ else
|
||||
## - delete existing ssh tunnels
|
||||
## -
|
||||
tunnel_pid_old=`ps x | grep -e "$ssh_tunnel_local_port:$target_host:$ssh_tunnel_target_port" | grep -v grep | awk '{print$1}'`
|
||||
|
||||
|
||||
if [ -n "$tunnel_pid_old" ]; then
|
||||
kill $tunnel_pid_old
|
||||
fi
|
||||
@@ -133,7 +133,7 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
|
||||
begin_m=`date +%M`
|
||||
backup_date=`date +"%d.%m.%Y"`
|
||||
backup_begin_timestamp=`date +"%s"`
|
||||
|
||||
|
||||
if $_via_ssh_tunnel ; then
|
||||
echolog "\nBegin saving host \"$target_host\" : $backup_date ( ${begin_h}:${begin_m} h )\n"
|
||||
else
|
||||
@@ -318,9 +318,9 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
|
||||
else
|
||||
echolog "\nGoing to backup mysql databases.. ( `$date +%H`:`$date +%M` h )"
|
||||
export mysql_user mysql_password mysql_credential_args mysql_gzip
|
||||
$script_dir/mysql_backup.sh
|
||||
$script_dir/mysql_backup.sh
|
||||
fi
|
||||
## - !!
|
||||
## - !!
|
||||
if $restart_apache ;then
|
||||
$ssh ${ssh_user}@$srcHost "sudo /etc/init.d/apache2 restart"
|
||||
fi
|
||||
@@ -349,7 +349,7 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
|
||||
echolog "\nGoing to backup network directories.. ( `$date +%H`:`$date +%M` h )"
|
||||
for dir in $net_mounted_dir_backup ; do
|
||||
#echolog "\n\tBackup network directory $dir"
|
||||
export mount_netdir
|
||||
export mount_netdir
|
||||
backup_dir=$dir $script_dir/net_mounted_dir_backup.sh
|
||||
done
|
||||
fi
|
||||
@@ -379,10 +379,10 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
|
||||
declare -a nextcloud_account_arr
|
||||
|
||||
# - Splitt on newlines
|
||||
# -
|
||||
# -
|
||||
# - Use: IFS=$'\n'
|
||||
# -
|
||||
IFS=$'\n' ; for _account in $nextcloud_accounts ; do
|
||||
IFS=$'\n' ; for _account in $nextcloud_accounts ; do
|
||||
nextcloud_account_arr+=("$(trim $_account)");
|
||||
done
|
||||
|
||||
@@ -487,6 +487,8 @@ fi
|
||||
|
||||
if $_via_ssh_tunnel ; then
|
||||
if [[ -n "$tunnel_pid" ]]; then
|
||||
kill "$tunnel_pid"
|
||||
if ps --pd ${tunnel_pid} > /dev/null 2>&^; then
|
||||
kill "$tunnel_pid"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user