![]() |
#1 |
Junior Member
Join Date: Sep 2010
Posts: 2
|
![]()
Hello
![]() I'm quite a newbie to NSIS and I am trying to check whether the PostgreSQL service is running, in which case I would go ahead and execute a certain piece of code, otherwise I would wait for 1 minute for the process to start, checking every second. Basically it would be a while loop, exit condition being either end of time either the desired process status. code: I would really like to know if this is the/a correct approach. Thanks in advance, Brad Last edited by preotul; 21st September 2010 at 19:23. Reason: bad grammar |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
New to programming in general?
![]() You haven't thought about an action to take if the service is never started. You could have this after the loop:code: Stucode: Last edited by Afrow UK; 21st September 2010 at 19:46. Reason: Added SERVICE_RUNNING check |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Sep 2010
Posts: 2
|
Hey! big thanks!
![]() This was everything I knew of the GetServiceStatus code: so for some reason I assumed that it returns 1 in $0 when status is running and anything else if it fails, popping the info in $1. Basically I get a 0 in $0 when I get a status from the service and it pops a 4 in $1 if the status is running. Also, now I know how the for statement looks like ![]() In case I get out after 60 seconds I wont execute the code that follows, but that I didn't include that in the present code. As a matter of fact I forgot some things in the code I wrote (the jump backwards) so I can see why you assumed I was new to programming ^^ Anyway, big thanks ![]() |
![]() |
![]() |
![]() |
|
Tags |
if-else, increment, loop, service, sleep |
Thread Tools | Search this Thread |
Display Modes | |
|
|