Page 1 of 1

Modify file, then start service (problem)

Posted: Tue Nov 22, 2005 11:19 am
by Guest
I have a service that needs to start when the installer is done. However, the installer needs to modify a file before I can start the service. So I need to install some files, modify one of them, and then start a service.

I tried using "edit INI file" (since the file to modify is a .ini) but we don't use section tags (i.e. [general] or [win32]) so it wouldn't modify the file.

So I'm using the EditFile plugin after ApplyInstall but that means that I can't use ControlService to start the service.

I tried using RunProgram with the command line "NET START IntelliServer" (which works on a normal command line) after EditFile but that isn't starting it either.

So my possible solutions are to include a dummy section tag in the ini file, or do a second ApplyInstall to start the service. I would rather not do the dummy tag since the ini file may turn to XML later. Would a second ApplyInstall ruin the uninstall if it only started the service? Would it be better to do an ApplyInstall for the ini file only, edit the file, then ApplyInstall for everything else (including starting the service)? Am I using RunProgram wrong? It feels like I have a few possible work arounds but not a fix. Is there a better solution that I'm not thinking of?

Posted: Tue Nov 22, 2005 2:30 pm
by Dana Epp
I am using Run Program to start a service at the end of the install as well.

The way I did it was after the Apply Install set it up so:

Run Program: $WINSYSDIR$\\net.exe
Hide Program Window: Checked
Command Line: start myservicename
Wait for Program to Finish: Checked
Return Result in Variable: SRVSTART

Then I check to ensure it started. If not, error it to the user and let them manually do it.

Works great. It hasn't errored out to the user yet.

Posted: Tue Nov 22, 2005 2:54 pm
by Guest
Sweet. :D I figured that the command line text box was if you wanted to run something from the command line. I didn't have anything in the Run Program text box. Thanks.

Suggestion to InstallAware: Change that label from "Command Line" to "Command Line Arguments" so us morons don't get confused. :wink:

Posted: Tue Nov 22, 2005 3:26 pm
by sinan
Sorry for the confusion :) v5 will have the text updated.