Create new log every hour

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Create new log every hour

17 Nov 2018, 06:51

Hi all,

I am working on a script, in which I am saving ping output with timestamp of my servers to a text file.

I am using the following command

Code: Select all

IP = 10.0.0.2
Formattime, logtime, %A_Now%, yyyy-MM-dd_HH

Ext = | cmd /q /v /c "(pause&pause)>nul & for /l `%a in() do(set /p `"data=`" && echo(!date! !time! !data!)&ping -n 2 localhost>null"

Run,%comspec% /c ping %IP% -t %Ext% >> "%IP%_%logtime%.log"
It is executing well and creating log too.the problem is with log size,if I keep running this script , it is creating a huge log
I just want to create new log for every hour or every 10 mb.?

Suggest a way to achieve.

Thanks in advance
SDK.
roysubs
Posts: 426
Joined: 29 Sep 2018, 16:37

Re: Create new log every hour

18 Nov 2018, 08:00

When I try to run the script, it says "in() unexpected at this time". Could you check that line please (the Ext = line that is)?
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Re: Create new log every hour

18 Nov 2018, 23:11

Thanks for the reply rousubs
It is 'in ()'
There is a sapce, it was auto corrected.

Regards,
Sdk
roysubs
Posts: 426
Joined: 29 Sep 2018, 16:37

Re: Create new log every hour

19 Nov 2018, 18:12

I changed that, and also the "do(set" to "do (set", but now I just get a black screen with nothing going on. Could you get the script working and update / edit the original post then I'll try it again please?
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Re: Create new log every hour

19 Nov 2018, 21:52

Yeah..it's just a blank cmd screen,
The cmd output redirects to a text file, I will post my complete script.

Thanks for showing interest roysubs.
Regards
SDK

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot] and 340 guests