[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: help with scripting



>I have writing a script to reboot my Linux 5.2 box. This part works ok,
>but I want to have the error messages append to a log file with a time
>stamp next to the error message.
>
>Here is my script
>
>#!/bin/bash
>#
>time_stamp=`date +"%c"`
>cd /
>exec nohup /sbin/shutdown -r -y 1 > /dev/console 1>&- 2>> $time_stamp
>/root/error.log&- &.


What about:

file=/var/log/error.log
exec >> $file 2>&1
time_stamp=`date +"%c"`
cd /
echo time_stamp
exec nohup /sbin/shutdown -r -y





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]