Damit die Ausgabe eines Scripts in ein Log geschrieben wird, kann man sich dieses Konstrukts bedienen:
#!/bin/bash
# vars
backupdir="/backup/weeklyRestartOTRS"
logfile="${backupdir}/logs/weeklyRestartOTRS.log"
date=`date '+%Y%m%d'`
# rotate log file if necessary
if [ -f ${logfile} ]
then
/bin/mv ${logfile} ${logfile}_${date}
fi
Hier dazwischen folgt nun das eigentliche Script
exec /dev/null 2>&1
