Options

Running a program while idle and then another program when not idle

DevilsbaneDevilsbane Member Posts: 4,214 ■■■■■■■■□□
Hey guys,

I've been running the folding at home application for sometime. (Folding@home - Main) If you aren't familiar, it is the largest distributed computer network out there and was set up to simulate protein folding and misfolding. The results could help understand and cure things like cancer, alzheimers, parkinsons ect.

Anyway, what I want to do is start the program when my computer goes idle. It uses unused process cycles and I have never noticed any sort of strain on my system, but I want to add another process that will only start when I am not at my pc. This is easy enough to setup with schedule tasks, but shutting it down is a bit harder.

There are actually 3 processes being used. Folding at home comes with 2 processes. The first is a .exe file that is used to start the core and will also display information about it. I usually call this FAH.exe. The second is another .exe and is responsible for actually doing the work. The name of this can vary. When the FAH.exe process is ended, the core will also end. The third process is the one that I am actually starting. It is a .bat file that runs wscript pointed at invisible.vbs to launch FAH.exe without displaying the screen. Once FAH.exe has been launched, start.bat ends.

Now I have already created another .bat file named End.bat which contains a taskkill command to end the FAH.exe process which will in turn will also end the core. But how can I set it up so that this runs automatically when the computer is no longer idle?

Why not just stick this on my desktop and run it everytime I sit down? For myself, that wouldn't be such a big deal. But I am trying to do this for a friend who has agreed to participate but doesn't really know much and I want it to be convenient or he might just say to hell with it.

EDIT: I'm team 201768 if you want to join in and try it out.
Decide what to be and go be it.

Comments

  • Options
    DevilWAHDevilWAH Member Posts: 2,997 ■■■■■■■■□□
    Devilsbane wrote: »
    Hey guys,

    I've been running the folding at home application for sometime. (Folding@home - Main) If you aren't familiar, it is the largest distributed computer network out there and was set up to simulate protein folding and misfolding. The results could help understand and cure things like cancer, alzheimers, parkinsons ect.

    Anyway, what I want to do is start the program when my computer goes idle. It uses unused process cycles and I have never noticed any sort of strain on my system, but I want to add another process that will only start when I am not at my pc. This is easy enough to setup with schedule tasks, but shutting it down is a bit harder.

    There are actually 3 processes being used. Folding at home comes with 2 processes. The first is a .exe file that is used to start the core and will also display information about it. I usually call this FAH.exe. The second is another .exe and is responsible for actually doing the work. The name of this can vary. When the FAH.exe process is ended, the core will also end. The third process is the one that I am actually starting. It is a .bat file that runs wscript pointed at invisible.vbs to launch FAH.exe without displaying the screen. Once FAH.exe has been launched, start.bat ends.

    Now I have already created another .bat file named End.bat which contains a taskkill command to end the FAH.exe process which will in turn will also end the core. But how can I set it up so that this runs automatically when the computer is no longer idle?

    Why not just stick this on my desktop and run it everytime I sit down? For myself, that wouldn't be such a big deal. But I am trying to do this for a friend who has agreed to participate but doesn't really know much and I want it to be convenient or he might just say to hell with it.

    EDIT: I'm team 201768 if you want to join in and try it out.

    But this is part of the application, you can set it to only run when PC is idle, or run as bacck ground process.

    if you set it to run only when idle it will not use any resorces unless PC is idle, if it runs as a back ground process it will run along side other programs.

    What else do you need, is this not enough?
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • Options
    DevilWAHDevilWAH Member Posts: 2,997 ■■■■■■■■□□
    Oh sorry i noticed you had another process you wanted to run.

    you could use some thing like Boinc or Condor which are tasks sedulers that you can set up to start and stop progams depending on the computer use.

    I did a lot with condor, its what things like FAH systems are based on , but you can also run it as stand alone to do what you want.
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • Options
    DevilsbaneDevilsbane Member Posts: 4,214 ■■■■■■■■□□
    Intresting enough, this was an easy fix.

    The batch file to launch it as a background task was unneeded. I just added the FAH.exe to scheduled tasks (testing) and found that when it launched it was already in the background. Then I just checked the "stop program when no longer idle" and it kills the FAH.exe which then shuts down the core with no problems.

    Like I said earlier, it is designed very well and I don't notice it slowing me down. Even when it is on 100% cpu usage my pc doesn't seem the least bit slow. But normal folk don't like to see their computer being maxed out. So now 5 minutes after he walks away it will engage the process and will stop it when he comes back so he never has to worry about it taking over his machine.

    Thanks for the posts.
    Decide what to be and go be it.
  • Options
    DevilsbaneDevilsbane Member Posts: 4,214 ■■■■■■■■□□
    I am trying to embrace the command line (schtasks.exe) more because it is usually much better about allowing you to configure things just the way you want to. Unfortunately I am having some trouble with scheduling a task to run when idle and then to stop when not idle. I can easily fix this using the GUI by checking the "Stop the task if the computer ceases to be idle." and uncehcking the "Stop the task if it runs for 72 hours"

    Both of those are defaults and I can't find any command line switches to fix it.

    Here is the command I'm running.
    Schtasks /create /tn "Task" /tr "\"C:\Program Files\Folder\Program.exe\"" /sc onidle /i 
    1 /ru SYSTEM
    

    By doing some google searches I have found dozens of people with the same question, but none of them have answers. I just have a hard time believing that Microsoft left these options out of the cli.
    Decide what to be and go be it.
Sign In or Register to comment.