I will install our software from a client machine, and I want to run a procedure CreateServiceCMD which stops/starts three services on the file server. Therefore on the file server runs a fourth service, which will wait for a CMD-File. The advantage is: No Administrator privileges are needed for the installation!
You have to know how it works (should work):
start setup from client machine
after selecting the paths, the procedure CreateServiceCMD(stop) will create the CMD file on the server, and my special service will stop the three other services
installing the files on the server
starting the application once with the parameter "UpdateAutoClose" (see below), so the application will be started, the database will be updated, the application closes automatically, and everything is ok, and setup is finished
but before finishing I have to call the procedure CreateServiceCMD(start) that my special service on the server starts the other three services again.
I tried everything but I can't find the right position for the CreateServiceCMD(start). AfterInstall, PostInstall, wpFinished, DeInitializeSetup() and I tried it for hours...
[Run]
Filename: "{code:GetInstallDir|Program}\{#AppStartName}"; Parameters: "-UpdateAutoClose"; \
Flags: postinstall skipifsilent; \
Description: "{cm:LaunchProgram, {#AppName} {#AppVerTxt} Datenbank Update}"
The problem is, I have to wait till the application has closed again and then run my procedure, but I can't find the right place. Everything I tried is much too early.
Hope someone can help...?
I believe you are looking for the CurStepChanged:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
{ installation is starting }
CreateServiceCMD(stop);
end
else
if CurStep = ssPostInstall then
begin
{ installation has finished }
CreateServiceCMD(start);
end;
end;
Related
There is a problem with your environment because the Application Express files have not been loaded. Please verify that you have copied the images directory to your application server as instructed in the Installation Guide. In addition, please verify that your image prefix path is correct. Your current path is /i/ (it should contain both starting and ending forward slashes, such as the default /i/). Use the SQL script reset_image_prefix.sql if you need to change it.
Starting with Apex 18.1.x.x.x we should be instead putting CDN location as static path for images. Local path will not be supported any further.
Take a look at below announcement :
https://blogs.oracle.com/apex/announcing-oracle-apex-static-resources-on-oracle-content-delivery-network
CDN makes application faster.
Coming to problem you mentioned, can be easily resolved by performing below steps :
Locate reset_image_prefix.sql . It should be under 'apex/utilities'
change directory :
cd apex/utilities
Connect to DB and check what is image prefix
connect to SQL as SYS
SQL> set serveroutput on
SQL> begin
2 dbms_output.put_line(apex_200100.wwv_flow_image_prefix.g_image_prefix);
3
4 end;
5 /
It should list /i/ or any other location you may have configured with
Note: whenever you run the above command change to the correct APEX user (version), so for APEX 19.1 you use apex_190100.
4. Now, check CDN address. For example Apex 20.1.X.X.XX location is - https://static.oracle.com/cdn/apex/20.1.0.00.13/
Same can be checked from https://blogs.oracle.com/apex/announcing-oracle-apex-static-resources-on-oracle-content-delivery-network
5. Now, its time to run SQL (assuming you have APEX 19.2.0.X.XX version)
SQL> #reset_image_prefix.sql
Enter the Application Express image prefix [/i/] https://static.oracle.com/cdn/apex/19.2.0.00.18/
...Changing Application Express image prefix
NEW_IMAGE_PREFIX
------------------------------------------------
https://static.oracle.com/cdn/apex/19.2.0.00.18/
Go to http://your-host:your-port/ords/apex_admin
Problem should be resolved by now!
Im new to chef and trying to understand why this code does not return any error while if i do the same with 'start' i will get an error for such service does not exist.
service 'non-existing-service' do
action :stop
end
# chef-apply test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* service[non-existing-service] action stop (up to date)
Don't know which plattform you are running on if you are running on Windows it should at least log
Chef::Log.debug "#{#new_resource} does not exist - nothing to do"
given that you have debug as log level.
You could argue this is the wrong behaviour, but if the service dose not exist it for sure isen't running.
Source code
https://github.com/chef/chef/blob/master/lib/chef/provider/service/windows.rb#L147
If you are getting one of the variants of the init.d provider, they default to getting the current status of a service by grepping the process table. Because Chef does its own idempotence checks internally before calling the provider's stop method, it would see there is no such process in the table and assume it was already stopped.
Our installation process includes a Windows Service which is installed if our software is configured to be installed as a server (vs. a client installation). I added a service library to be able to manage the services, then in the files, I added handlers for BeforeInstall and AfterInstall events...
[Files]
Source: "MyService.exe"; DestDir: "{app}"; Check: IsServer; BeforeInstall: BeforeServiceInstall('MyServiceName', 'MyService.exe'); AfterInstall: AfterServiceInstall('MyServiceName', 'MyService.exe')
procedure BeforeServiceInstall(SvcName, FileName: String);
var
S: Longword;
begin
//If service is installed, it needs to be stopped
if ServiceExists(SvcName) then begin
S:= SimpleQueryService(SvcName);
if S <> SERVICE_STOPPED then begin
SimpleStopService(SvcName, True, True);
end;
end;
end;
procedure AfterServiceInstall(SvcName, FileName: String);
begin
//If service is not installed, it needs to be installed now
if not ServiceExists(SvcName) then begin
if SimpleCreateService(SvcName, 'My Service Name', ExpandConstant('{app}')+'\' + FileName, SERVICE_AUTO_START, '', '', False, True) then begin
//Service successfully installed
SimpleStartService(SvcName, True, True);
end else begin
//Service failed to install
end;
end;
end;
When installing the service for the first time (doesn't already exist and isn't currently running), the installation/starting of this service works just fine. However, when running this installer on an existing installation (upgrade), the installer stops when it recognizes that this service is running, and prompts to terminate the process (before it calls the BeforeServiceInstall() handler)...
How do I prevent this prompt from appearing for services? I'm avoiding having to require a restart and would still like this prompt to appear for all other files.
There is currently no direct way to exclude a file from checking if it's in use. You can disable this control globally (by setting CloseApplications directive value to no), which I wouldn't recommend. Or you can set a filter for files, which will be checked (in the CloseApplicationsFilter directive), which for you might require e.g. to list all the files except your service executable, which is hard to maintain.
You may also list all the files to be checked by specifying a filter which won't match any of your files and adding them from the RegisterExtraCloseApplicationsResources event method is the same as doing this from the mentioned directive.
What I would suggest is to stop your service from the PrepareToInstall event method. Its reference explicitly suggests this (emphasized by me):
You can use this event function to detect and install missing
prerequisites and/or to shutdown any application which is about to
be updated.
This event method is executed before all the file in use checks are performed and allows you to say that you need a system restart for cases when stopping of your service fails for some reason. If you wouldn't require restart, you may just return a string with some sensible message what happened to the user.
For your script it would just mean to move the code from your BeforeServiceInstall procedure to the PrepareToInstall event method and remove the BeforeInstall parameter from the entry.
I am new to webistrano so apologies if this is a trivial matter...
I am using webistrano to deploy php code to several production servers, this is all working great. My problem is that I need to clear HTML cache on my cache servers (varnish cache) after the code update. I can't figure out how to build a recipe that will be executed on the webistrano machine (and will run the relevant shell script that will clear the cache) and not on each of the deployment target machines.
Thanks for the help,
Yariv
Simpliest method is to execute varnishadm tool with proper parameters inside deploy:restart
set :varnish_ban_pattern, "req.url ~ ^/"
set :varnish_terminal_address_port, "127.0.0.1:6082"
set :varnish_varnishadm, "/usr/bin/varnishadm"
task :restart, :roles => :web do
run "#{varnish_varnishadm} -T #{varnish_terminal_address_port} ban \"#{varnish_ban_pattern}\""
end
Thanks for the answer. I actually need to do some more stuf than to only clear the the cache so I will execute a bash script locally as described in below:
How do I execute a Capistrano task locally?
I'm trying to configure Capistrano so that it works for our server setup. We are deploying symfony projects so i'm also using capifony. I'm still experiencing some problems with permissions.
On our server every project runs as a project user, so every project has it's own user. So i configured use_sudo and set it to true and i configured the admin_runner to be the user of the project. But it still didn't work so i modified the capifony to start using try_sudo in stead of the regular run. Which made it work a little bit better. But i'm a bit confused about what to use in which case. You have try_sudo, sudo and run. But which is needed for which use-case?
When you use run i think it'll always be your local user
try_sudo i think will check if the use_sudo flag is true if so it will use the sudo command if not it will use the local user. If you have admin_runner configured it will sudo to the user configured as admin_runner
sudo will always try to sudo
Now my problem is the deploy:symlink method this is also just a regular run command so it executes as the local user, which gives permission problems when i try to view the website.
So can anyone tell me if my description of the 3 commands is correct? and also does anyone know how the admin_runner and use_sudo is suposed to be used, so that the symlink is also being done correctly (and also all other commands done by capistrano)?
kind regards,
Daan
Apologies for such a tardy answer Daan. Your understanding of Capistrano is correct. Note also that the :use_sudo flag defaults to true.
In Capistrano 2.11.2, you'll find lib/capistrano/configuration/variables.rb:
_cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
and lib/capistrano/recipes/deploy.rb:
def try_sudo(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
command = args.shift
raise ArgumentError, "too many arguments" if args.any?
as = options.fetch(:as, fetch(:admin_runner, nil))
via = fetch(:run_method, :sudo)
if command
invoke_command(command, :via => via, :as => as)
elsif via == :sudo
sudo(:as => as)
else
""
end
end
Perhaps your permissions problem involves your server, running as a normal user, not being able to read the contents of the release directory that your current symlink is pointing to?