This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Restart an application- Installshield 2009
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 12, 2009
03:19 PM
Restart an application- Installshield 2009
Hey,
I'm building a installer where I have the Apache exe file. I wrote a couple of script to control few aspects of my installer.
Now I have one issue, I need to delete the httpd.conf( hope so the extension is .conf) which is in the apache and copy my http.conf to apache\\apache2\\conf and RESTART my apache monitor.
Hope I can do the delete part with the below script:
if(DeleteFile(DEL_DIR ^ DEL_FILE) < 0) then
MessageBox("Delete failed.", SEVERE);
else
MessageBox("File Deleted.", INFORMATION);
endif;
Is there a script that helps me to RESTART apache monitor once the httpd.conf is copied to apache?
Thanks
Rachel
I'm building a installer where I have the Apache exe file. I wrote a couple of script to control few aspects of my installer.
Now I have one issue, I need to delete the httpd.conf( hope so the extension is .conf) which is in the apache and copy my http.conf to apache\\apache2\\conf and RESTART my apache monitor.
Hope I can do the delete part with the below script:
if(DeleteFile(DEL_DIR ^ DEL_FILE) < 0) then
MessageBox("Delete failed.", SEVERE);
else
MessageBox("File Deleted.", INFORMATION);
endif;
Is there a script that helps me to RESTART apache monitor once the httpd.conf is copied to apache?
Thanks
Rachel
(22) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2009
10:28 AM
Custom Action allows executing these actions, you can have a look on the documentation.
:confused: But be careful Apache is protected by the Apache License
:confused: But be careful Apache is protected by the Apache License
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2009
01:34 PM
Could you be more specific of which Custom Action am I to use?
My installer is of Installscript project type. At first, I self extract the apache exe and then go for delete httpd.conf and copy my httpd.conf and finally I want to RESTART my apache monitor.
Thanks much
Rachel
My installer is of Installscript project type. At first, I self extract the apache exe and then go for delete httpd.conf and copy my httpd.conf and finally I want to RESTART my apache monitor.
Thanks much
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 16, 2009
03:16 AM
If you use InstallScript, thinks are differents but the standard is to use MSI.
In InstallScript you have a function LaunchAppAndWait
You can use it to run the appropriate command to restart apache.
Regards.
In InstallScript you have a function LaunchAppAndWait
You can use it to run the appropriate command to restart apache.
Regards.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 16, 2009
12:54 PM
Oh No.
Alright, is there a script to run a batch file?
Will BatchFileLoad script do the work? or do we have any other script?
Thanks
Rachel
Alright, is there a script to run a batch file?
Will BatchFileLoad script do the work? or do we have any other script?
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
11:35 AM
Since there's no specific script to RESTART apache, I wrote a batch file for apache.
net stop Apache2
net start Apache2.
This works fine in my cmd.exe but when I try it on my installer using installscript it doesn't. The script I used was BatchFileLoad, like the one below.
#define TARGET_BATCH "C:\\Program Files\\Company Name\\services.bat"
if(BatchFileLoad(TARGET_BATCH) < 0) then
MessageBox("Unable to load batch file.", SEVERE);
else
MessageBox("Batch file loaded successfully.", INFORMATION);
endif;
So I go by launching the apache.exe first and finally go for restarting the service through batch file. The issue is I couldn't see the Apache stop for a sec and again start like the cmd.exe. Just the message "Batch file loaded successfully" shows up.
What I need to do with the script, to see the apache monitor stop and then start again and then finish my installer.
Any help would be appreciated!
Thanks
Rachel
net stop Apache2
net start Apache2.
This works fine in my cmd.exe but when I try it on my installer using installscript it doesn't. The script I used was BatchFileLoad, like the one below.
#define TARGET_BATCH "C:\\Program Files\\Company Name\\services.bat"
if(BatchFileLoad(TARGET_BATCH) < 0) then
MessageBox("Unable to load batch file.", SEVERE);
else
MessageBox("Batch file loaded successfully.", INFORMATION);
endif;
So I go by launching the apache.exe first and finally go for restarting the service through batch file. The issue is I couldn't see the Apache stop for a sec and again start like the cmd.exe. Just the message "Batch file loaded successfully" shows up.
What I need to do with the script, to see the apache monitor stop and then start again and then finish my installer.
Any help would be appreciated!
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
11:45 AM
So are you saying that it does actually stop and start the service, it's just you can't see it?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
12:06 PM
YES, I couldn't actually see it. I'm not very sure about the stop and start thing. I just get this messagebox displayed.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
03:42 PM
Could you do this in VBS just to test and make sure you are seeing what you want to see? Inbetween the stop and start you can do a wscript.sleep(5000) to give you a 5 second wait.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
04:17 PM
Gavin,
Won't these two lines do the job of Stop and Start.
ServiceStopService(szServicename) and
ServiceStartService(szServicename,"")
I did see the change of what I should.
Am I on the right track?
Thanks
Rachel
Won't these two lines do the job of Stop and Start.
ServiceStopService(szServicename) and
ServiceStartService(szServicename,"")
I did see the change of what I should.
Am I on the right track?
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
04:26 PM
That is most defiantly the best way. I have a tendency to forget InstallShied most likely has API to do everything needing done.
This is why I keep asking them for an API list.. 😛
This is why I keep asking them for an API list.. 😛
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
05:24 PM
If by API list you mean a list of built-in functions, the help section Reference > InstallShield Language Reference > Built-in Functions... is what you want. (When you mentioned API functions in a separate thread, I thought you meant pre-prototyped Windows API functions.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 17, 2009
05:40 PM
When I say API List, I'm meaning both.. Anything that can be called within IS. However, 😮 I hadn't see this list somehow. I must of looked past this several times. This will allow me to quit asking so many questions.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
10:20 AM
Hey,
I find this kinda weird. The below script works fine
ServiceStopService(szServiceName);
MessageBox("Application stopped.", INFORMATION);
ServiceStartService(szServiceName, "");
MessageBox("Application Restarted.", INFORMATION);
But not this one:
ServiceStopService(szServiceName);
ServiceStartService(szServiceName, "");
MessageBox("Application Restarted.", INFORMATION);
Does it mean I need to have the msgBox displayed? Coz I don't want display the msgbox for stop service but only for start service. When I run my 2nd script it stops but doesn't start.
Is the msgbox for stop so important? If YES, why?
Thanks
Rachel
I find this kinda weird. The below script works fine
ServiceStopService(szServiceName);
MessageBox("Application stopped.", INFORMATION);
ServiceStartService(szServiceName, "");
MessageBox("Application Restarted.", INFORMATION);
But not this one:
ServiceStopService(szServiceName);
ServiceStartService(szServiceName, "");
MessageBox("Application Restarted.", INFORMATION);
Does it mean I need to have the msgBox displayed? Coz I don't want display the msgbox for stop service but only for start service. When I run my 2nd script it stops but doesn't start.
Is the msgbox for stop so important? If YES, why?
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
11:33 AM
While sometimes there's something special about showing some UI, generally the important effect of a message box would be the delay. Try calling Delay instead of MessageBox.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
11:35 AM
Sounds like a timing issue.. Try putting a Sleep(100); in between them. May just need a cycle, which can possibly be done with Sleep(0);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
11:50 AM
No didn't work.
I seriously couldn't understand :confused: , why it's not actually starting the application but just displays the msgbox.
It stops the application after a Delay of 2 seconds, it displays the msgbox "Application restarted" but it actually doesn't, my application remains in the stop state. The application I'm using here is Apache.
Thanks
Rachel
I seriously couldn't understand :confused: , why it's not actually starting the application but just displays the msgbox.
It stops the application after a Delay of 2 seconds, it displays the msgbox "Application restarted" but it actually doesn't, my application remains in the stop state. The application I'm using here is Apache.
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
11:55 AM
Michael mentioned Delay.. I didn't realized Delay was in there. In some software there is a small difference between Sleep and Delay. So I would give that a try.
Delay is used just like Sleep. Delay(100);
Delay is used just like Sleep. Delay(100);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
03:39 PM
What's the solution for this problem of mine?
I'll brief what my installer does. At first it extracts the exe's in the installer and then goes for copying few files from the installer to few target locations on the client system, finally after the file httpd.conf being copied to conf folder in Apache, I want the application to stop and again start.
Why the application doesn't start even though the msgbox displays that "Application started"? Am I missing any parameters?:(
Any help would be appreciated!
Thanks
Rachel
I'll brief what my installer does. At first it extracts the exe's in the installer and then goes for copying few files from the installer to few target locations on the client system, finally after the file httpd.conf being copied to conf folder in Apache, I want the application to stop and again start.
Why the application doesn't start even though the msgbox displays that "Application started"? Am I missing any parameters?:(
Any help would be appreciated!
Thanks
Rachel
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2009
04:20 PM
I did a test with 2009 and 2010. I didn't use any Delay or Sleep and it worked fine. I'm unsure what the problem could be.
The API is synchronous so you shouldn't have to use any Sleeps or Delays in between them.
The API is synchronous so you shouldn't have to use any Sleeps or Delays in between them.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 19, 2009
09:20 AM
But I want this working for me.
Will the following parameters do any help,
dwcheckpoint. dwWaitHint,dwControlsAccepted.
or
SERVICE_IS_PARAMS.nStopServiceWaitCount(1000)
ServiceStopService(szServiceName);
SERVICE_IS_PARAMS.nStopServiceWaitCount(1000);
ServiceStartService(szServiceName,"");
Also I read that if I use the ServiceStartService built-in, it stops the running service and restarts. So it may be enough if I use ServiceStartService.
Thanks
Rachel
Will the following parameters do any help,
dwcheckpoint. dwWaitHint,dwControlsAccepted.
or
SERVICE_IS_PARAMS.nStopServiceWaitCount(1000)
ServiceStopService(szServiceName);
SERVICE_IS_PARAMS.nStopServiceWaitCount(1000);
ServiceStartService(szServiceName,"");
Also I read that if I use the ServiceStartService built-in, it stops the running service and restarts. So it may be enough if I use ServiceStartService.
Thanks
Rachel
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)