When run is executed from /etc/init.d/autobuild-ceph -> loop.sh,
its stdout/stderr are not redirected, so still go to the invoking
user's terminal, which will become unwritable after logout.
Send the logging from run itself to logs/*.
Signed-off-by: Dan Mick <dan.mick@redhat.com>
#!/bin/sh
set -e
+# stdout/stderr are not yet redirected on /etc/init.d systems
+exec >>logs/stdout.log 2>>logs/stderr.log
+
FILE_OWNER="$(stat --format='%U' gitbuilder.git/out)"
CUR_USER="$(id -un)"
if [ "$FILE_OWNER" = "root" ]; then
logrotate -v --state=logs/.logrotate.status logrotate.conf
fi
+# if the log was rotated, move to the new files; if not
+# nothing changes
exec >>logs/stdout.log 2>>logs/stderr.log
+
cd gitbuilder.git
exec ../run-real