Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Startup script to delete file


Reply
Fix Vista Errors
Thread Tools Display Modes

Startup script to delete file

 
 
jbdmom
Guest
Posts: n/a

 
      12-04-2009
Hello,

I'm afraid I'm not well versed in Windows Server, but I think what I want to
do is very simple.

I need to have the startup of Server 2003 delete a file that may or may not
exist.

And here is why - when the server is not shutdown correctly (e.g. power
outage), the .pid file for our rsync service does not get deleted. So when
the server starts up again, the rsync service does not start because the .pid
file exists.

So I'd like to have the file deleted on startup, just in case it is there.

I've done a lot of research, but am getting very confused about the easiest
way to go about this.

Thank you for your time.

 
Reply With Quote
 
 
 
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      12-04-2009
jbdmom <> wrote:
> Hello,
>
> I'm afraid I'm not well versed in Windows Server, but I think what I
> want to do is very simple.
>
> I need to have the startup of Server 2003 delete a file that may or
> may not exist.
>
> And here is why - when the server is not shutdown correctly (e.g.
> power outage), the .pid file for our rsync service does not get
> deleted. So when the server starts up again, the rsync service does
> not start because the .pid file exists.
>
> So I'd like to have the file deleted on startup, just in case it is
> there.
>
> I've done a lot of research, but am getting very confused about the
> easiest way to go about this.
>
> Thank you for your time.


A simple batch file at startup applied via group or local policy would do
this ....


if exist "c:\blah\folder name\blah.file" del "c:\blah\folder name\blah.file"
/q

I'm sure there are a zillion other ways but this would work.

That said, Iif your server is not being shut down properly due to a power
failure, you need to get a good managed UPS that can initiate a graceful
shutdown for this and all servers (if you have many servers you need a NIC
in the UPS and it has to be a unit of sufficient size to handle multiple
servers).


 
Reply With Quote
 
jbdmom
Guest
Posts: n/a

 
      12-04-2009

Thank you so much.

I agree we should have a UPS, but those decisions are out of my hands. I
can only work with what I've got.

Thanks again.


"Lanwench [MVP - Exchange]" wrote:

> jbdmom <> wrote:
> > Hello,
> >
> > I'm afraid I'm not well versed in Windows Server, but I think what I
> > want to do is very simple.
> >
> > I need to have the startup of Server 2003 delete a file that may or
> > may not exist.
> >
> > And here is why - when the server is not shutdown correctly (e.g.
> > power outage), the .pid file for our rsync service does not get
> > deleted. So when the server starts up again, the rsync service does
> > not start because the .pid file exists.
> >
> > So I'd like to have the file deleted on startup, just in case it is
> > there.
> >
> > I've done a lot of research, but am getting very confused about the
> > easiest way to go about this.
> >
> > Thank you for your time.

>
> A simple batch file at startup applied via group or local policy would do
> this ....
>
>
> if exist "c:\blah\folder name\blah.file" del "c:\blah\folder name\blah.file"
> /q
>
> I'm sure there are a zillion other ways but this would work.
>
> That said, Iif your server is not being shut down properly due to a power
> failure, you need to get a good managed UPS that can initiate a graceful
> shutdown for this and all servers (if you have many servers you need a NIC
> in the UPS and it has to be a unit of sufficient size to handle multiple
> servers).
>
>
> .
>

 
Reply With Quote
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      12-04-2009

jbdmom <> wrote:
> Thank you so much.
>
> I agree we should have a UPS, but those decisions are out of my
> hands. I can only work with what I've got.


Sure. This is when you send an email to all your bosses and say "We need to
get a UPS. I've priced them out and this is the one we need. It will do X,
Y, Z. Without this our servers will crash in the event of a power failure
and can sustain expensive and time-consuming damage, and we also run the
risk of damaging hardware due to power surges."

Then you save your message somewhere safe. Remember, stupid should hurt.

>
> Thanks again.


No problem.


>
>
> "Lanwench [MVP - Exchange]" wrote:
>
>> jbdmom <> wrote:
>>> Hello,
>>>
>>> I'm afraid I'm not well versed in Windows Server, but I think what I
>>> want to do is very simple.
>>>
>>> I need to have the startup of Server 2003 delete a file that may or
>>> may not exist.
>>>
>>> And here is why - when the server is not shutdown correctly (e.g.
>>> power outage), the .pid file for our rsync service does not get
>>> deleted. So when the server starts up again, the rsync service does
>>> not start because the .pid file exists.
>>>
>>> So I'd like to have the file deleted on startup, just in case it is
>>> there.
>>>
>>> I've done a lot of research, but am getting very confused about the
>>> easiest way to go about this.
>>>
>>> Thank you for your time.

>>
>> A simple batch file at startup applied via group or local policy
>> would do this ....
>>
>>
>> if exist "c:\blah\folder name\blah.file" del "c:\blah\folder
>> name\blah.file" /q
>>
>> I'm sure there are a zillion other ways but this would work.
>>
>> That said, Iif your server is not being shut down properly due to a
>> power failure, you need to get a good managed UPS that can initiate
>> a graceful shutdown for this and all servers (if you have many
>> servers you need a NIC in the UPS and it has to be a unit of
>> sufficient size to handle multiple servers).
>>
>>
>> .




 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PlainText ver - EXTREMELY USEFUL INFO - Printing Directory Listings Dave Windows Vista General Discussion 0 11-21-2009 11:42 PM
chkdsk : NTFS on Vista x64 Nigel Windows Vista File Management 5 06-02-2008 02:02 PM
Unable to delete a file in Vista Premimun Home FP Windows Vista File Management 2 12-08-2007 07:17 PM
File Won't Delete Stuart Windows Vista File Management 1 12-18-2006 12:55 AM
What is up with Vista's file system? Stan Shankman Windows Vista File Management 7 08-15-2006 07:59 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59