Click here to Skip to main content
16,007,610 members
Home / Discussions / System Admin
   

System Admin

 
AnswerRe: change shell from prompt on windows me? Pin
Michael Dunn22-Jun-01 22:00
sitebuilderMichael Dunn22-Jun-01 22:00 
GeneralApplication control Pin
17-Jun-01 5:58
suss17-Jun-01 5:58 
Question2 mice in win2K? Pin
John M. Drescher14-Jun-01 11:07
John M. Drescher14-Jun-01 11:07 
GeneralDriver Sound Card Pin
7-Jun-01 18:13
suss7-Jun-01 18:13 
QuestionWho have CNET card driver for Linux Redhat 7.1 ? Pin
7-Jun-01 7:43
suss7-Jun-01 7:43 
GeneralWMI Scripting Questions Pin
Joe Paisley4-Jun-01 5:36
Joe Paisley4-Jun-01 5:36 
GeneralScript file to shut down server at a certain time Pin
30-May-01 19:26
suss30-May-01 19:26 
GeneralRe: Script file to shut down server at a certain time Pin
Garth J Lancaster30-May-01 20:18
professionalGarth J Lancaster30-May-01 20:18 
Gidday - I may be a bit rusty on the fine points, and there are always
a number of ways to skin the cat, but here's what I would do ..

1) set up the scheduler - Im going to assume you dont have
the newer version, and use the AT command, its a bit basic,
but hey, learn how to walk before you can run Smile | :)

a) get a dos prompt
b) type AT
c) if you get the response like 'Schedule service not started',
type NET START SCHEDULE

2) a forced shutdown of the system will (should) stop all services,
so you dont really have to do this manually for each service.

I would use 'shutdown' from the NT Resource Kit, if
you dont have the NT Resource Kit, you can probably find
a copy of shutdown somewhere, and other companies like
Novell have their own version sitting around ..

3) assume you wanted to shutdown the machine every Monday
to Friday at 19:00 .. You can use the AT scheduler to do it

The hardest thing is you cant assume from an AT event
what the environement - eg path etc is, so I find the
safest way is to either put the shutdown command in a script,
and/or implicitly specify its path ..

So assuming Shutdown is in C:\NTReskit,

AT 7:00p /Every:Mo,Tu,We,Th,Fr CMD /C "START /DC:\NTReskit Shutdown.exe /L/Y/C"

Will run the command shutdown, from C:\NTResKit, with the given
parameters..

It is important that for whatever version of shutdown you
use, you know what the consequences and parameters are..

In the case I've shown, /L = Local, /C = Force Close, /Y =
answer Y to all questions - if you had a program that should save
its data, this wouldnt be too bright !!!

so do a 'shutdown /?' before you really start something
in production, to see what paras are what .... similarly, 'AT /?' shows
the options (if not a bit terse)

4) ok, so we can expand on the above .. lets say you create
a directory called c:\scripts, and in that, a script
called 'shutdown.cmd'

in that script, if you had services called business1, business2,
and you wanted to stop them first, you could do something like ..
(note, 'sleep' also comes from the NT resource kit, and is
handy for waiting for events .. you could use /T:60 in the
shutdown command to get the same effect )

@echo off
rem
rem This script created (date & time) by (who)
rem
rem 1st stop the business1 service
net stop business1
rem 2nd stop the business2 service
net stop business2
rem wait 60 seconds for the services to stop
c:\NTResKit\sleep 60
rem now shutdown the machine (if any services remain
rem awake, they will die anyway)
C:\NTResKit\shutdown /L /Y /C

you could of course tart this up, but at least comment it
etc ...

then, the AT command becomes a bit simpler

AT 7:00p /Every:Mo,Tu,We,Th,Fr CMD /C C:\Scripts\ShutDown.CMD

Initiates the Script ... (well, should, I havnt tested it, this
is all off un-caffienated memory)

phew - that should be enough to get you off and running. There
are also good books available on NT scripting, get your boss
to buy you one .. you can look for "Windows NT Shell Scripting"
by Tim Hill, Macmillan Technical Publishing for example ..

ps ... to get a list of running services, use the 'net start' command
- its generally not wise to stop system services
you know nothing about, unless you really are a masochist..
sometimes things start getting complex when you see a service
with a name like business service 1 .. then, you really have to
use a script, and put quotes around the service name, thus

net stop "business service 1"

- you can see how this gets hard doing it all on one line, so a script
is really you're best choice ... and of course if you have more than one
service you really want to stop, the hard way, you dont have a choice ...

pps you should make sure your services are set to Automatic start
if you expect them to run again when the machine re-boots

I hope this helps ..


Garth Lancaster
Integration Engineer
Sydney, Australia
GeneralRe: Script file to shut down server at a certain time Pin
1-Jun-01 5:30
suss1-Jun-01 5:30 
GeneralRe: Script file to shut down server at a certain time Pin
Garth J Lancaster3-Jun-01 23:41
professionalGarth J Lancaster3-Jun-01 23:41 
GeneralRe: Script file to shut down server at a certain time Pin
5-Jun-01 19:13
suss5-Jun-01 19:13 
GeneralRe: Script file to shut down server at a certain time Pin
Garth J Lancaster7-Jun-01 13:21
professionalGarth J Lancaster7-Jun-01 13:21 
GeneralRe: Script file to shut down server at a certain time Pin
7-Jun-01 21:35
suss7-Jun-01 21:35 
GeneralRe: Script file to shut down server at a certain time Pin
Garth J Lancaster7-Jun-01 21:51
professionalGarth J Lancaster7-Jun-01 21:51 
GeneralRe: Script file to shut down server at a certain time Pin
8-Jun-01 20:29
suss8-Jun-01 20:29 
GeneralRe: Script file to shut down server at a certain time Pin
Garth J Lancaster9-Jun-01 1:44
professionalGarth J Lancaster9-Jun-01 1:44 
GeneralRe: Script file to shut down server at a certain time Pin
20-Jun-01 2:56
suss20-Jun-01 2:56 
GeneralRe: Script file to shut down server at a certain time Pin
20-Jun-01 3:57
suss20-Jun-01 3:57 
GeneralWinNT service and system shutdown Pin
"Le Phuc Nguyen Tuan"25-May-01 19:17
"Le Phuc Nguyen Tuan"25-May-01 19:17 
GeneralRe: WinNT service and system shutdown Pin
Kyui Oh20-Jun-01 17:11
Kyui Oh20-Jun-01 17:11 
GeneralReplacing Windows 95/98 logon Pin
Grzegorz Stelmaszek22-May-01 2:13
Grzegorz Stelmaszek22-May-01 2:13 
GeneralRe: Replacing Windows 95/98 logon Pin
Dhanush31-May-01 1:29
professionalDhanush31-May-01 1:29 
GeneralRe: Replacing Windows 95/98 logon Pin
Dhanush31-May-01 1:29
professionalDhanush31-May-01 1:29 
GeneralRe: Replacing Windows 95/98 logon Pin
Dhanush31-May-01 1:29
professionalDhanush31-May-01 1:29 
QuestionGetting the current CPU load ??? Pin
Brian van der Beek21-May-01 9:45
Brian van der Beek21-May-01 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.