preotul
21st September 2010, 18:21
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.
$5 = 0
$6 = 0
PGServiceCheck:
${If} $5 == 60
Goto PGServiceEnd
${EndIf}
SimpleSC::GetServiceStatus "postgresql-8.4"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; return the status of the service (See "service_status" in the parameters)
${If} $0 == 0
$6 = 1
${EndIf}
${If} $6 == 1
Goto PGServiceEnd
${EndIf}
IntOp $5 $5 + 1
Sleep 1000
PGServiceEnd:
I would really like to know if this is the/a correct approach.
Thanks in advance,
Brad
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.
$5 = 0
$6 = 0
PGServiceCheck:
${If} $5 == 60
Goto PGServiceEnd
${EndIf}
SimpleSC::GetServiceStatus "postgresql-8.4"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; return the status of the service (See "service_status" in the parameters)
${If} $0 == 0
$6 = 1
${EndIf}
${If} $6 == 1
Goto PGServiceEnd
${EndIf}
IntOp $5 $5 + 1
Sleep 1000
PGServiceEnd:
I would really like to know if this is the/a correct approach.
Thanks in advance,
Brad