Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 07, 2016, 06:16:50 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA small script to set a timer to startup jkdefrag.exe when computer idle for  (Read 6640 times)

delwoode

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 142
    • View Profile
    • Donate to Member
I would like to have jkdefrag start defragging when ever my computer is idle for ( you could set a time 10mins or whatever)

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Use the screensaver installed with jkdefrag/MyDefrag.

FWIW, the new jkdefrag is now called MyDefrag:
http://www.mydefrag.com/
http://www.mydefrag.net/ (GUI)


delwoode

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 142
    • View Profile
    • Donate to Member
Use the screensaver installed with jkdefrag/MyDefrag.

FWIW, the new jkdefrag is now called MyDefrag:
http://www.mydefrag.com/
http://www.mydefrag.net/ (GUI)
I knew about the screensaver technique, Its not what i want and i hate screensavers and have them disabled



skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,667
    • View Profile
    • Donate to Member
I would like to have jkdefrag start defragging when ever my computer is idle for ( you could set a time 10mins or whatever)
Is this as simple as starting/stopping the MyDefrag.exe process?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
You could use the Task Scheduler in Windows.  The gotcha' with scheduling defraggers after some period of "idle time" is that the idle detection almost always only checks the CPU usage.

When I bought my first Vista PC I didn't know defrag.exe was in the task scheduler by default.  In the middle of running JkDefrag Windows decided my computer had been "idle" long enough to start defrag.exe.  Yup!!  It ran defrag.exe in the middle of a disk defrag job!!!  Talk about stupid!!!

Unfortunately in Windows they don't make it easy to detect the disk usage.  That's why I posted awhile ago asking if somebody had a "disk busy" detection algorithm.  Basically, it's a pita and I wouldn't mess with it.  Better if you want that feature to try to get a defrag suite with that feature built in.  Presumably the defrag programmers know enough about the innards to detect when the disk has been at low usage for a period of time.

My feeling is I'd rather run them manually.  But I only have 2 PCs.  I could see if you had a bank of machines you'd want to automate it.  Still, it's generally not good to do a defrag inside a defrag. :)

delwoode

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 142
    • View Profile
    • Donate to Member
O.K. seems like its not the best idea i could have had!!  best to drop this.
What made me think of it  - is because some of the bigger expensive disk defraggers defrag in the  background when the computer is idle, sort of a bit at a time to keep your pc drives unfragmented.  But your right it would be hard to decide what was idle, low cpu usage, low hard drive usage etc.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,667
    • View Profile
    • Donate to Member
I was more thinking of idle away time.  You know...if you haven't moved the mouse for ten minutes, fire up the defragger.  Chances are you're away from the desk and don't really care about CPU or disk usage at that point.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
You could use my IdleStart application. It will launch whatever you configure it to, after the length of idle time you configure passes. So it sort of acts like a screensaver, but for opening files and launching applications. (there is no actual screensaver involved)

I was more thinking of idle away time.  You know...if you haven't moved the mouse for ten minutes, fire up the defragger.  Chances are you're away from the desk and don't really care about CPU or disk usage at that point.

That is exactly what my IdleStart application does.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,667
    • View Profile
    • Donate to Member
Bingo.  =]

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
I'm not sure about what I'm about to say, but I'm sure if f0dder sees this he may provide more details.
I believe it's not a good idea to be defragmenting the disk every time the PC idles, for 2 reasons:
- The constant strain on the disk will probably make it fail sooner
- NTFS already tries to keep a low fragmentation. I would say "it never needs defrag", but I would probably be wrong, so I say it "seldom needs defrag" :)

y0himba

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 435
  • Yar.
    • View Profile
    • y0himba.net
    • Read more about this member.
    • Donate to Member
You could use Windows built in task scheduler, set it to run the task when idle and stop the task when the computer isn't idle or on mouse movement. Easiest way to do it.  Or, you can use JKDefragGUI which sets this up for you.

If you want to use JKDefrag only: http://www.emro.nl/freeware/
If you want to use it's successor MYDefrag: http://www.wieldraai....nl/MyDefragGUI.html

Both include a ton of options and the ability to schedule a defrag. 

Be sure to check out the rest of the freeware available on those sites.  Good stuff.
My Web Site:  http://www.y0himba.net

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
I don't understand what's wrong with the JK/MyDefrag "screen saver" solution?

  • It starts the JK/MyDefrag GUI and defrags if the PC is idle and stops if the user returns. Other solutions (task scheduler, IdleStart, ...) would keep the defrag task running if the user returns
  • It will start another screensaver after defrag finishes. If someone hates screensavers and won't use any energy savings option, just select the LogOn or Black Screen screensaver.
  • And - nice feature: "Do not run if the last completed run was less than xx hours ago". Other solutions would start defragging again and again...


@jgpaiva
Agree 100%! I defrag my system partition once a month... ;)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
You could use my IdleStart application. It will launch whatever you configure it to, after the length of idle time you configure passes. So it sort of acts like a screensaver, but for opening files and launching applications. (there is no actual screensaver involved)

I was more thinking of idle away time.  You know...if you haven't moved the mouse for ten minutes, fire up the defragger.  Chances are you're away from the desk and don't really care about CPU or disk usage at that point.

That is exactly what my IdleStart application does.



What defines "idle" ??
If it also includes disk usage then I'd be very interested.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
You could use Windows built in task scheduler, set it to run the task when idle and stop the task when the computer isn't idle or on mouse movement. Easiest way to do it.  Or, you can use JKDefragGUI which sets this up for you.

If you want to use JKDefrag only: http://www.emro.nl/freeware/
If you want to use it's successor MYDefrag: http://www.wieldraai....nl/MyDefragGUI.html

Both include a ton of options and the ability to schedule a defrag. 

Be sure to check out the rest of the freeware available on those sites.  Good stuff.

If you are going to do it that way I suggest making the Idle period longer than it takes the burn a Double Layer DVD if you do such burns.  It's very easy to forget a scheduled task.  With a DVD burn you're not hitting the keyboard or mouse once it starts usually, and even though the HD is accessing with a solid LED the system will show as idle.  There needs to be disk access measurement for this stuff to be trustoworthy imho.

Either that or you just have to remember it's on there and set the idle time longer than any task you are going to run unattended.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
You could use my IdleStart application. It will launch whatever you configure it to, after the length of idle time you configure passes. So it sort of acts like a screensaver, but for opening files and launching applications. (there is no actual screensaver involved)

I was more thinking of idle away time.  You know...if you haven't moved the mouse for ten minutes, fire up the defragger.  Chances are you're away from the desk and don't really care about CPU or disk usage at that point.

That is exactly what my IdleStart application does.



What defines "idle" ??
If it also includes disk usage then I'd be very interested.


User idle time, as defined by how long it has been since a human* has interacted with the pc, either by use of the keyboard or mouse.



In theory it would be a human, but of course it could also be a cat, dog, space alien, earthquake, asteroid hitting desk, or some other force that causes the mouse to move or keys to be pressed on the keyboard.
« Last Edit: August 26, 2009, 03:37:55 AM by app103 »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
how long it has been since a human* has interacted with the pc,

Ok I wanted to make sure.  So far the only small utility I've seen that does disk access monitoring is a little Tray App that simulates the LED for HD access(called HardDriveIndicator.)  I don't remember if I ever saw the source or just read the info while looking on the MS site but it uses some performance profile calls(WMI I think) to get the disk activity over the last 2 minutes or something.  But I think those defraggers that run in background either do that or hook right into the disk driver code somehow.  For non device driver probably all you can do is the WMI stuff.

Unless you can measure the disk access there's no way to be sure your scheduled task won't kick off right in the middle of a DVD burn or a defrag by another defragger the user started manually(like if they forgot the scheduled task was there or are not the user who put it there and just decided to defrag.)


app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Unless you can measure the disk access there's no way to be sure your scheduled task won't kick off right in the middle of a DVD burn or a defrag by another defragger the user started manually(like if they forgot the scheduled task was there or are not the user who put it there and just decided to defrag.)

That's why IdleStart has an option on the tray menu to disable it without closing it. If I were burning something or defragging manually, I'd disable it till it was finished and then turn it back on.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
...
That's why IdleStart has an option on the tray menu to disable it without closing it. If I were burning something or defragging manually, I'd disable it till it was finished and then turn it back on.

That's interesting.  If I could suggest one feature, maybe a time of day span window when the task can fire?  Like, be able to set it to only fire on idle if between 2 AM and 4 AM type of thing?

I just noticed too looking at the latest version of Auslogics Defrag under the schedule options it gives options for a combined CPU/Disk idle percentage.  How it's calculated I don't know but I didn't notice the "disk" part before.  Guess I'll have to try it out of curiosity.

edit: in case anyone is curious, I set up Auslogics defrag to automatic.  It gives ranges from 10 to 30 minutes idle time and I used the default 20% CPU/disk idle setting.  My disk was recently defragged so I didn't notice that much disk activity but the tray icon twirled around for a few minutes.  Looks like it's good enough that my secondary machine might be defragged automatically.  I haven't tested what you have to do to pause the defrag though.  So far it seems like a plausible alternative.
« Last Edit: August 26, 2009, 05:38:32 PM by MilesAhead »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member

That's interesting.  If I could suggest one feature, maybe a time of day span window when the task can fire?  Like, be able to set it to only fire on idle if between 2 AM and 4 AM type of thing?

I think this application is best kept as-is, in order not to frustrate myself or others.

IdleStart is very simply designed. It doesn't store any settings to the registry or to any type of config file. Everything is passed as a command line parameter. This way, one single copy of IdleStart can be used simultaneously for multiple applications with different parameters for each one.

If I save the times to run to the registry or a config file, it would either lose the ability for multiple instances to run with different configurations, or become a complicated mess requiring me to code the whole thing over from scratch and plan it much differently.

And I think adding more command line parameters might make it more confusing for users to use, with more potential for it not to do what they expected, no matter how good my instructions are.


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
I was meaning to ask if you had IdleStart configured so that multiple instances could run but I got distracted when I noticed the Auslogics scheduling thing.  :Thmbsup:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Just in case anyone is curious, the Auslogics auto defrag in the latest version seems to work.  I'm not clear yet on what the actual threshold is to trigger an actual defrag as opposed to an analysis after the idle time.  I sent a question to Auslogics for more info about it and requested they have it user configurable(as in, if analysis shows >= 20% fragmentation, do the defrag.)  If I get anything more that a template reply I'll post it.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
btw I did hear back from Auslogics support.  They claim currently a threshold of 5% fragmentation is hard-wired into the program. I haven't seen it fire on my Vista64 or W7 32 bit machines other than to analyze even with fragmentation of 25%.

SmartDefrag seems to actually trigger a fragmentation stage but I don't really like what it does.  Looks like for the time being I'm going with MyDefrag Fast Optimize now and then with Auslogics manual defrag for day to day defrags inbetween.

So far I haven't seen anything automatic I really like.