Capturing shutdown

nnCron and nnCron LITE discussion

Capturing shutdown

Postby Frank » Sat, 14 May 2016, 00:42

Hello,
I am trying to capture the shutdown process to delete some windows temp files older than 7 days on a small drive.
I have tried this:

Code: Select all
#( Delete_WinTemp
WatchQueryShutdown
Action:
    INTERCEPT-SHUTDOWN
    PAUSE: 1000
    RECURSIVE
    PURGE-OLDA: "q:\temp\*" 7
    BALLOON: "Attention!" "Windows Temp file older than 3 days have been deleted!"
    BEEP: 250 500
    PAUSE: 1000
    CONTINUE-SHUTDOWN
)#


I do not believe that this is working because I do not receive the Balloon and the size of the drive does not change.
Could someone help with this script?
Thanks
Last edited by VoidVolker on Thu, 09 Jun 2016, 23:01, edited 1 time in total.
Reason: Use bb-tag 'code' for source code
Frank
 
Posts: 30
Joined: Sun, 02 Apr 2006, 09:18

Re: Capturing shutdown

Postby semko » Sat, 14 May 2016, 09:00

Since Windows 7 it's impossible by design to intercept the shutdown and suspend processes. Do your maintenance work on WatchLogon or WatchResume or on a regular time base.
semko
 
Posts: 46
Joined: Sat, 08 Oct 2005, 17:42
Location: Germany

Re: Capturing shutdown

Postby Frank » Mon, 16 May 2016, 00:38

Thank you.
I have now changed it to:

Code: Select all
#( Delete_WinTemp
WatchLogon: "*"
Action:
    PAUSE: 60000
    RECURSIVE
    PURGE-OLDA: "q:\temp\*" 7
    BALLOON: "Attention!" "Windows Temp file older than 7 days have been deleted!"
    BEEP: 250 500
    PAUSE: 30000
)#


The only problem now that I have is empty directories will accumulate. How do I delete all empty directories?
Thanks
Last edited by VoidVolker on Thu, 09 Jun 2016, 23:01, edited 1 time in total.
Reason: Use bb-tag 'code' for source code
Frank
 
Posts: 30
Joined: Sun, 02 Apr 2006, 09:18

Re: Capturing shutdown

Postby semko » Mon, 16 May 2016, 10:19

Add WITHDIRS as a modifier:

Code: Select all
...
RECURSIVE
WITHDIRS
...
Last edited by VoidVolker on Thu, 09 Jun 2016, 23:01, edited 1 time in total.
Reason: Use bb-tag 'code' for source code
semko
 
Posts: 46
Joined: Sat, 08 Oct 2005, 17:42
Location: Germany

Re: Capturing shutdown

Postby Frank » Tue, 17 May 2016, 01:18

I thought of that, but I think I will have problem deleting old folders with new files in it.
Frank
 
Posts: 30
Joined: Sun, 02 Apr 2006, 09:18


Return to nnCron forum (English)

Who is online

Users browsing this forum: Bing [Bot] and 7 guests

cron