services: unattended-upgrade: Log output of the 'guix' commands.
Fixes <https://bugs.gnu.org/43011>. Reported by Jesse Gibbons <jgibbons2357@gmail.com>. Until now the stdout/stderr file descriptors were not redirected. * gnu/services/admin.scm (unattended-upgrade-mcron-jobs)[code]: Remove 'with-logging' and use 'redirect-port' instead.master
parent
384377632c
commit
fe42e5f39c
|
@ -255,13 +255,6 @@ Old log files are removed or compressed according to the configuration.")
|
||||||
(timestamp))
|
(timestamp))
|
||||||
(exit 1))
|
(exit 1))
|
||||||
|
|
||||||
(define-syntax-rule (with-logging exp ...)
|
|
||||||
(with-output-to-port log
|
|
||||||
(lambda ()
|
|
||||||
(with-error-to-port log
|
|
||||||
(lambda ()
|
|
||||||
exp ...)))))
|
|
||||||
|
|
||||||
;; 'guix time-machine' needs X.509 certificates to authenticate the
|
;; 'guix time-machine' needs X.509 certificates to authenticate the
|
||||||
;; Git host.
|
;; Git host.
|
||||||
(setenv "SSL_CERT_DIR"
|
(setenv "SSL_CERT_DIR"
|
||||||
|
@ -271,7 +264,10 @@ Old log files are removed or compressed according to the configuration.")
|
||||||
(sigaction SIGALRM alarm-handler)
|
(sigaction SIGALRM alarm-handler)
|
||||||
(alarm #$(unattended-upgrade-maximum-duration config))
|
(alarm #$(unattended-upgrade-maximum-duration config))
|
||||||
|
|
||||||
(with-logging
|
;; Redirect stdout/stderr to LOG to save the output of 'guix' below.
|
||||||
|
(redirect-port log (current-output-port))
|
||||||
|
(redirect-port log (current-error-port))
|
||||||
|
|
||||||
(format #t "~a starting upgrade...~%" (timestamp))
|
(format #t "~a starting upgrade...~%" (timestamp))
|
||||||
(guard (c ((invoke-error? c)
|
(guard (c ((invoke-error? c)
|
||||||
(report-invoke-error c)))
|
(report-invoke-error c)))
|
||||||
|
@ -293,7 +289,7 @@ Old log files are removed or compressed according to the configuration.")
|
||||||
|
|
||||||
;; XXX: If 'mcron' has been restarted, perhaps this isn't
|
;; XXX: If 'mcron' has been restarted, perhaps this isn't
|
||||||
;; reached.
|
;; reached.
|
||||||
(format #t "~a upgrade complete~%" (timestamp)))))))
|
(format #t "~a upgrade complete~%" (timestamp))))))
|
||||||
|
|
||||||
(define upgrade
|
(define upgrade
|
||||||
(program-file "unattended-upgrade" code))
|
(program-file "unattended-upgrade" code))
|
||||||
|
|
Reference in New Issue