So easy on unix, but how do I do this on windows?

Message boards : Questions and problems : So easy on unix, but how do I do this on windows?
Message board moderation

To post messages, you must log in.

AuthorMessage
Far

Send message
Joined: 18 Jun 09
Posts: 9
Australia
Message 33734 - Posted: 11 Jul 2010, 8:19:36 UTC

Hi,

This is v simple on *nix, but if someone could help me with windows equivalent it be really appreciated.

I want to do something like schedule a windows batch script that checks (at about 11pm) if boinc processes are running. If not then start them.

Scheduling something i'm fine with, but something that checks if a process exists first I don't know how to do. Or if there is a better way?

Thanks,
Far
ID: 33734 · Report as offensive
Profile Gundolf Jahn

Send message
Joined: 20 Dec 07
Posts: 1069
Germany
Message 33737 - Posted: 11 Jul 2010, 10:40:34 UTC - in response to Message 33734.  

If you have installed BOINC as a service (Protected Application Execution), you could analyse the output of the NET START command.

Otherwise, if you don't mind the error messages, you could try to start boinc.exe anyway. Since it won't allow two instances running simultanously, the second one would be aborted.

Gruß,
Gundolf
Computer sind nicht alles im Leben. (Kleiner Scherz)
ID: 33737 · Report as offensive
Far

Send message
Joined: 18 Jun 09
Posts: 9
Australia
Message 33754 - Posted: 13 Jul 2010, 2:16:50 UTC

Yep starting boinc.exe leaves a DOS window, but that's fine. And if it is running the second instance closes itself.

The tasks appear to have started. Are they OK running without boincmgr.exe - do they report back/update/etc themselves?

Far
ID: 33754 · Report as offensive
Profile Gundolf Jahn

Send message
Joined: 20 Dec 07
Posts: 1069
Germany
Message 33756 - Posted: 13 Jul 2010, 7:43:35 UTC - in response to Message 33754.  
Last modified: 13 Jul 2010, 7:44:02 UTC

Yep starting boinc.exe leaves a DOS window, but that's fine. And if it is running the second instance closes itself.

Try starting boinc.exe with the --detach option [detach from console (Windows), see boinc.exe --help]

The tasks appear to have started. Are they OK running without boincmgr.exe - do they report back/update/etc themselves?

Yep, BOINC manager is just the GUI for the client and can be started anytime to watch the progress. It should leave the client running on exit if it didn't start it, but to be sure, check the manager exit options.

Gruß,
Gundolf
ID: 33756 · Report as offensive
Professor Ray

Send message
Joined: 31 Mar 08
Posts: 59
United States
Message 33762 - Posted: 14 Jul 2010, 2:53:47 UTC
Last modified: 14 Jul 2010, 3:03:10 UTC

You can accomplish virtually any such goal with various scripting technologies. VBScript is one such animal. Powershell is another. If you're a 'Nix guru - writing shell scripts and all that - then that's the thing to be diggin' the manual out for with respect to Windoze (not that anybody's actually respecting that and whatnot). I'm just saying. Powershell should be a pice of caeke for 'Nix gurus.

Here'x a taste of some code for the latter that would I.D. if something of interest was executing:

$FgText1 = "DarkGreen"
$FgText2 = "DarkGray"
$FgError="Red"

Write-Host("==============================================================================") -foreground $FgText1;
Write-Host("BOINC checker...") -foreground $FgText1;
Write-Host("==============================================================================") -foreground $FgText1;
Write-Host("");
$ProcessToCheckFor = "'boinc.exe'";
$TotalProcessesCount = 0;

# Create a list of process handles which are running on the system
$PidList = @(Get-WmiObject win32_process -Filter "name=$ProcessToCheckFor");
$TotalProcessesCount = $PidList.length;

$PidHandleList = $PidList | Foreach-Object { $_.Handle };

Write-Host("Total {0} Processes Count: {1}" -f $ProcessToCheckFor, $TotalProcessesCount) -foreground $FgText1;


Obviously the script is not complete - I don't work for free - and as it stands its merely informative in nature; it takes no action. Obviously Powershell would need being intalled and the necessary Win, GPO and NTFS, ACL entries in place on the platform executing such script. But its not just doable, but feasible.

You could do that also with a C++ app that utiliizes a Win32 api library include.
ID: 33762 · Report as offensive
Far

Send message
Joined: 18 Jun 09
Posts: 9
Australia
Message 33868 - Posted: 21 Jul 2010, 4:25:39 UTC - in response to Message 33762.  

Thanks - that's what I was after!
ID: 33868 · Report as offensive

Message boards : Questions and problems : So easy on unix, but how do I do this on windows?

Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.