jba@harald.ruc.dk (Jan B. Andersen) (02/07/90)
I have written a script, bdate, which gets called at the bottom of
/etc/bcheckrc. It's not a menu, but it works fine for us.
--------------[ /etc/bdate ]------------
dig2()
{
if [ $1 -lt 10 ]
then digits="0"`expr $1 + 0`
else digits=$1
fi
}
TZ=DNT-1DST
export TZ
echo "\nSETTING System Date And Time\n"
ls -l > /dev/null; echo "\007\c"
ls -l > /dev/null; echo "\007\c"
ls -l > /dev/null; echo "\007\c"
echo "\nThe current date and time is : `date` \n"
echo "Is the above information correct?\c"
echo "\tEnter \"y\" for yes or \"n\" for no : \007\c"
read answer
if [ $answer = n ]
then
set `date "+%m %d %H %M %y"`
m=$1 d=$2 h=$3 n=$4 y=$5
newdt=
echo "\nEnter the month\t\t[$m] \c"
read val ; dig2 ${val:-$m} ; newdt=$digits
echo "Enter the day\t\t[$d] \c"
read val ; dig2 ${val:-$d} ; newdt=${newdt}$digits
echo "Enter the hour\t\t[$h] \c"
read val ; dig2 ${val:-$h} ; newdt=${newdt}$digits
echo "Enter the minute\t[$n] \c"
read val ; dig2 ${val:-$n} ; newdt=${newdt}$digits
echo "Enter the year\t\t[$y] \c"
read val ; dig2 ${val:-$y} ; newdt=${newdt}$digits
fi
date $newdt >/dev/null
case $? in
0)
echo "\nThe new date and time is : `date` \n"
;;
*)
$0
esac
mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) (02/11/90)
In article <213@harald.UUCP> jba@harald.ruc.dk (Jan B. Andersen) writes:
:I have written a script, bdate, which gets called at the bottom of
:/etc/bcheckrc. It's not a menu, but it works fine for us.
:
:--------------[ /etc/bdate ]------------
:dig2()
:{
: if [ $1 -lt 10 ]
: then digits="0"`expr $1 + 0`
: else digits=$1
: fi
:}
:
:TZ=DNT-1DST
:export TZ
:
:echo "\nSETTING System Date And Time\n"
:
:ls -l > /dev/null; echo "\007\c"
:ls -l > /dev/null; echo "\007\c"
:ls -l > /dev/null; echo "\007\c"
:
:echo "\nThe current date and time is : `date` \n"
:
:echo "Is the above information correct?\c"
:echo "\tEnter \"y\" for yes or \"n\" for no : \007\c"
:
:read answer
:if [ $answer = n ]
:then
: set `date "+%m %d %H %M %y"`
: m=$1 d=$2 h=$3 n=$4 y=$5
: newdt=
:
: echo "\nEnter the month\t\t[$m] \c"
: read val ; dig2 ${val:-$m} ; newdt=$digits
:
: echo "Enter the day\t\t[$d] \c"
: read val ; dig2 ${val:-$d} ; newdt=${newdt}$digits
:
: echo "Enter the hour\t\t[$h] \c"
: read val ; dig2 ${val:-$h} ; newdt=${newdt}$digits
:
: echo "Enter the minute\t[$n] \c"
: read val ; dig2 ${val:-$n} ; newdt=${newdt}$digits
:
: echo "Enter the year\t\t[$y] \c"
: read val ; dig2 ${val:-$y} ; newdt=${newdt}$digits
:fi
:date $newdt >/dev/null
:
:case $? in
:0)
: echo "\nThe new date and time is : `date` \n"
: ;;
:*)
: $0
:esac
Am I missing something in this thread or are people actually
shutting their Towers down daily. I can imagine some circumstances
when that might be necessary - in an environment in which the power
is shut off nightly, or where the air conditioning is shut off for
any length of time. Other than that, it seems an extraordinary
thing to do. We bring ours down only to change the kernel or
to clear up catastrophic errors (like yesterday, when I munged
two ports due to a slight programming error (mine, unfortunately)).
As for the person doing startup not having the same password as the
system administrator, our policy is that all the root accounts
(root - startup - sa or va - shutdown - multi - single) have the
same password, since any one of them has the power to do major
damage.
As for changing the date, log in as root (in single user mode is
preferable, or you may confuse running programs), and
enter:
date 0209143290
for instance to set the date to Feb 9, 1990 2:32 PM
format is mmddhhmm[yy] - month(2 places)day(2 places)hour(2 places
in 24 hour notation)minutes(2 places)and optionally the year(2 places).
Disclaimer: I do not represent the opinions of anyone in NCR's
Tower Division - I am just a happy user. After finally seeing what
some other vendors deliver as UNIX - a very happy user.
--
Dan Mercer
Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)
nick@toro.UUCP (Nicholas Jacobs) (02/13/90)
In article <1879@ncrcce.StPaul.NCR.COM> mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) writes: >As for changing the date, log in as root (in single user mode is >preferable, or you may confuse running programs), and >enter: > >date 0209143290 > >for instance to set the date to Feb 9, 1990 2:32 PM > >Dan Mercer In particular, I recommend that you do not do this while cron is running. You can end up with running jobs twice if you change the time when cron is within a certain window N of running a job (people will source code will presumably be able to determine this N) and you set the time ahead by N minutes. It seems like an alarm in cron goes off to run a job and then it ends up rescheduling the job again (granted my analysis is probably less than completely correct, but this is what I've seen!). However, I have reset the clock in multiuser mode with no ill effect once I killed cron. (Don't forget to restart cron :-)). Nicholas Jacobs +-----------------------+----------------------------+----------------------+ | UUCP: uunet!toro!nick | Internet: nick@toro.uu.net | AT&T: (212) 236-3230 | +-----------------------+----------------------------+----------------------+ "Disclaimer? The legal fees are probably more than my annual salary..."
joe@dayton.UUCP (Joseph P. Larson) (02/15/90)
In article <1273@toro.UUCP> nick@toro.UUCP (Nicholas Jacobs) writes: > >In particular, I recommend that you do not do this while cron is running. > >However, I have reset the clock in multiuser mode with no ill effect >once I killed cron. We somewhat regularily (and probably unwisely, but that's beside the point) fiddle with the system time in multiuser mode without touching cron. To the best of my knowledge, we've never had any trouble with this. However, I suspect part of our safety comes from the fact that the fiddling will happen during the day, we don't have that many cron jobs scheduled, and I think almost all of them run at night.... -Joe -- UUCP: rutgers!dayton!joe (Picts 1-16 are DHDSC - Joe Larson/MIS 1060 ATT : (612) 375-3537 now ready.) 700 on the Mall, Mpls, Mn. 55402