
how to know if a tape drive contain a tape.
Quote:
> Yes, this is the solution I had found: in my script mybackup.bat, I create
> first a file myfile.flg and after I run the ntBackup. After 4 hours another
> script start and check the file myfile.flg exist, if is true i resta the
> machine otherwise i do nothing because the mybackup.bat script had deleted
> the file myfile.flg at the end of the backup.
> But i would improve this backup, not starting the backup if the tape was not
> present - 'cause an operator don't insert the tape .
If installing WMI core on your NT4.0 servers is not just too much to ask,
then this little script will do what you need:
//
FileName: KillNTbackup.js
KillProcess("NTBACKUP.EXE");
function KillProcess(sProg) {
var oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Debug)}");
var sQuery = "select * from win32_process where name='" + sProg + "'";
var oEnm = new Enumerator(oWMI.execquery(sQuery));
for (;!oEnm.atEnd();oEnm.moveNext()) { oEnm.item().terminate(); }
Quote:
}
Call it just before you start backup:
:: Kill old NTBACKUP.EXE process (if present)
CScript "%BATpath%\KillNTbackup.js"
:: Run backup
ntbackup backup c: d: e: /d ....
It _will_ kill old lingering process if operator forgot to insert tape for
previous backup. Interestingly, resource kit's "kill.exe" can not kill old
process (although it says it did) when ntbackup.exe is stuck displaying (to
no one - on invisible desktop) modal dialog box prompting for tape, but WMI
solution effectivley terminates it regardless. Do it this way and you can
avoid re-boot (as a way of terminating orphaned ntbackup.exe process).
Branimir