Page 1 of 1 1
Topic Options
#108404 - 2003-11-19 08:32 PM Overwriting Files and Deleting Files
Jaide Offline
Fresh Scripter

Registered: 2003-03-05
Posts: 32
I have a script that pings all the servers on my network and writes that output to a file upon login for Admins:

If RedirectOutput("ping.log") = 0

Then emails that file to the group. I want to overwrite that file on every login and/or delete that file after login.

Any ideas?

Top
#108405 - 2003-11-19 08:41 PM Re: Overwriting Files and Deleting Files
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Use following code
Code:

$nul=RedirectOutput("ping.log",1)
;
; your code
;
; script completed and delete now the 'ping.log' file
$nul=RedirectOutput("")
DELETE ping.log


We suggest to use something like %tmp%\ as prefix for the filename 'ping.log'.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#108406 - 2003-11-19 08:43 PM Re: Overwriting Files and Deleting Files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You're going to have to post more than one line of code for us to understand what you are doing. My crystal ball is in the shop.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#108407 - 2003-11-19 09:28 PM Re: Overwriting Files and Deleting Files
Jaide Offline
Fresh Scripter

Registered: 2003-03-05
Posts: 32
Here it is:
Code:
  

$nul=RedirectOutput("ping.log",1)
For $i = 101 TO 108
If ping("192.168.1."+$i)
? "192.168.1."+$i+" is online"
Else
? "192.168.1."+$i+" is offline. Please check network connection."
EndIf
$nul=RedirectOutput("")



Then I want to mail the file using blat (works sometimes) and then delete the file after being mailed. Hope that helps!

Top
#108408 - 2003-11-19 09:48 PM Re: Overwriting Files and Deleting Files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Guess MCA's crystal ball is working just fine. Maybe in the future I will try to have a seance with him before posting.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.054 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org