View | Details | Raw Unified | Return to bug 56630
Collapse All | Expand All

(-)a/base/univention-server/debug.sh (-13 / +10 lines)
Lines 28-56 Link Here
28
# /usr/share/common-licenses/AGPL-3; if not, see
28
# /usr/share/common-licenses/AGPL-3; if not, see
29
# <https://www.gnu.org/licenses/>.
29
# <https://www.gnu.org/licenses/>.
30
30
31
function debug_info ()
31
debug_info () {
32
{
32
    IFS='.,' read -r ESEC NSEC <<<"$EPOCHREALTIME"
33
    IFS='.,' read ESEC NSEC <<<"$EPOCHREALTIME"
33
    printf '[%(%F %T)T.%06.0f]  DEBUG at %s:%s:%s: %s\n' "$ESEC" "$NSEC" "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$BASH_COMMAND" >&4
34
    printf "[%(%F %T)T.%06.0f]  DEBUG at %s:%s:%s: %s\n" "$ESEC" "$NSEC" "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$BASH_COMMAND" >&4
35
}
34
}
36
35
37
36
38
PAUSE_DEBUG ()
37
PAUSE_DEBUG () {
39
{
40
    set +o functrace
38
    set +o functrace
41
    trap - DEBUG
39
    trap - DEBUG
42
    IFS='.,' read ESEC NSEC <<<"$EPOCHREALTIME"
40
    IFS='.,' read -r ESEC NSEC <<<"$EPOCHREALTIME"
43
    printf "[%(%F %T)T.%06.0f]  PAUSE DEBUG\n" "$ESEC" "$NSEC" >&4
41
    printf '[%(%F %T)T.%06.0f]  PAUSE DEBUG\n' "$ESEC" "$NSEC" >&4
44
}
42
}
45
43
46
RESUME_DEBUG ()
44
RESUME_DEBUG () {
47
{
45
    IFS='.,' read -r ESEC NSEC <<<"$EPOCHREALTIME"
48
    IFS='.,' read ESEC NSEC <<<"$EPOCHREALTIME"
46
    printf '[%(%F %T)T.%06.0f]  RESUME DEBUG\n' "$ESEC" "$NSEC" >&4
49
    printf "[%(%F %T)T.%06.0f]  RESUME DEBUG\n" "$ESEC" "$NSEC" >&4
50
    set -o functrace
47
    set -o functrace
51
    trap "debug_info" DEBUG
48
    trap "debug_info" DEBUG
52
}
49
}
53
50
54
51
55
set -o functrace
52
set -o functrace
56
trap "debug_info" DEBUG
53
trap "debug_info" DEBUG
(-)a/base/univention-server/server_password_change (-10 / +4 lines)
Lines 43-51 eval "$(/usr/sbin/univention-config-registry shell)" Link Here
43
create_logfile_if_missing /var/log/univention/server_password_change.log "root:adm" 640
43
create_logfile_if_missing /var/log/univention/server_password_change.log "root:adm" 640
44
44
45
tmpfile=$(mktemp /tmp/server_password_change.debug.XXXXXX)
45
tmpfile=$(mktemp /tmp/server_password_change.debug.XXXXXX)
46
exec 4>>$tmpfile
46
exec 4>"$tmpfile"
47
exec 3>>/var/log/univention/server_password_change.log
47
exec 3> >(exec tee -ia /var/log/univention/server_password_change.log >&4 2>/dev/null)
48
exec 3> >(tee -ia  "/var/log/univention/server_password_change.log" $tmpfile  >/dev/null 2>/dev/null)
49
48
50
echowithtimestamp "Starting server password change" >&3
49
echowithtimestamp "Starting server password change" >&3
51
check_exit () {
50
check_exit () {
Lines 55-67 check_exit () { Link Here
55
       trap - DEBUG
54
       trap - DEBUG
56
       exec 4<&-
55
       exec 4<&-
57
56
58
       if [ -e $new_pass ]; then
57
       rm -f "$new_pass" "$old_pass"
59
               rm -f '$new_pass'
60
       fi
61
62
       if [ -e $old_pass ]; then
63
               rm -f '$old_pass'
64
       fi
65
58
66
       if [ $return_code -ne 0 ]; then
59
       if [ $return_code -ne 0 ]; then
67
               exec 3>>/var/log/univention/server_password_change.log
60
               exec 3>>/var/log/univention/server_password_change.log
Lines 148-153 fi Link Here
148
141
149
echowithtimestamp "Proceeding with regular server password change scheduled for today" >&3
142
echowithtimestamp "Proceeding with regular server password change scheduled for today" >&3
150
143
144
# shellcheck source=debug.sh
151
. /usr/lib/univention-server/lib/server_password_change/debug.sh
145
. /usr/lib/univention-server/lib/server_password_change/debug.sh
152
146
153
# Try to use a trivial command just to check that LDAP server is reachable.
147
# Try to use a trivial command just to check that LDAP server is reachable.

Return to bug 56630