mirror of
https://github.com/ceph/ceph
synced 2025-02-02 08:22:36 +00:00
6d6837834b
Instead of logging to a separate file which must be rotated manually, use the syslog (journald on teuthology.front). Keep a temporary unlinked file around in case we want to dump that to the cronjob stdout for a mail status. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
24 lines
439 B
Bash
Executable File
24 lines
439 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# check for no argument case and stop
|
|
if [ -z $1 ]; then
|
|
echo "need argument"
|
|
exit 1
|
|
fi
|
|
|
|
# Make a temporary unlinked file to hold the stdout/stderr
|
|
T=$(mktemp)
|
|
exec 10>"$T"
|
|
exec 11<"$T"
|
|
rm -f "$T"
|
|
|
|
# Forward to syslog (journald)
|
|
printf 'Running command: %s' "$*" | logger
|
|
"$@" |& tee >(logger) >&10
|
|
code=$?
|
|
|
|
if [ "$code" != 0 ] ; then
|
|
printf 'teuthology cronjob encountered error:\n'
|
|
head -n 10000 <&11
|
|
fi
|