Основываясь на альтернативном решении, предложенном @wurtel, я заработал так:
#!/bin/bash
LOGFILE="/root/logr/simple.log"
function sighuphandler() {
exec > >(tee "$LOGFILE") 2>&1
}
trap sighuphandler SIGHUP
LOGPATH="/root/logr"
MAX_LOGFILE_SIZE=5
rotateLog() {
currentsize=$(du -k $LOGFILE | cut -f1)
if [ $currentsize -ge $MAX_LOGFILE_SIZE ]; then
savelog -dn $LOGFILE &>/dev/null
kill -s SIGHUP $$
fi
}
sighuphandler
while :; do
echo "[`date "+%Y-%m-%d %H:%M:%S"`] [INFO] - A computer program can easily produce gibberish - especially if it has been provided with garbage beforehand. This program does something a little different. It takes a block of text as input and works out the proportion of characters within the text according to a chosen order. For example, an order of 2 means the program looks at pairs of letters, an order of 3 means triplets of letters and so on. The software can regurgitate random text that is controlled by the proportion of characters. The results can be quite surprising."
ls +
rotateLog
sleep 5
done
Вы всегда можете установить репозитории Fedora epel.
Не уверен, что вы можете отклониться от самого RHEL, но просто бросаете его туда.
sudo yum установить epel -выпуск