I have a sysv style init file for a service being used in centos 7.1
When the system boot up, the systemd generates a service file and it
seems to be enabled for both level 2 and level 3.
I have following questions:
1) Can the service be started twice at each run level ? [How can I prevent
it if it can start]
2) How can I check at which run-level the currently executing service
was started on ?
Thanks
Arvind
This depends on your service. If your service is an active service then starting it will not do anything. You can find if your service is an active service or not by running "systemctl status yourservice.service". In case your service is not active, you can tell systemd to treat it as an active service even after it quits. The directive for this is RemainAfterExit= (https://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit=).
To find out which run level your service has been started by you need to look at the "systemctl show yourservice.service" output. Look at what is listed on WantedBy= or RequiredBy= fields.
Related
I need some advice and explanation, according to my case. here is my kogito setup:
kogito service --> dataIndex-postgresql-->Kogito Management Console --> Kogito Task Console.
I create simple BPMN, it is just Task User.
Test scenario:
Service kogito, Console Management and task console Run,Then I submit the workflow until the phases complete in Task Console management.
Service kogito, Console Management and task console Run. Submit the wofkflow then the task success waiting in task console, then i stop the kogito service then run it again the kogito service. the task console will returned error "process instance with id 2493dndnxxx not found. when i try to post the task console.
I don't understand why. I really appreciate if some one can explain for this case, it is normal or not ?.
Thank you
i expect some one can explain this is normal situation or not ?.
in my understanding the process instance Id can submited the task even i stop the kogito service because we have dataIndex with postgresql.
A Kogito service is ephemeral by default, which means any process started will be lost if you restart the service. To maintain the state, you must add one of the persistence add-ons to your Kogito runtime project. See the docs here for more information about the supported persistence types https://docs.kogito.kie.org/latest/html_single/#con-persistence_kogito-developing-process-services.
In this other section,there are also some more details about how that can be combined when using other services like Data Index, which also supports different persistency types: https://docs.kogito.kie.org/latest/html_single/#con-data-index-service_kogito-configuring
My role have two handlers: start service and restart service. I want to run start service only if service was installed, and I want to restart service if I changed service configuration file.
(That were normal ansible handlers, now complicated part starts)
I want to avoid doing restart if I start application (started handler was executed).
Basically, if:
1. package was installed
2. config was changed
=> start service
if:
1. package wasn't changed
2. config was changed
=> restart service
I tried to play with listen, but it's designed for different purposes and can't help here.
Can someone give me an idea who to do this?
Services are being managed using an NSIS installer. On uninstallation those services are stopped using net stop, because it is synchronous, then flagged for deletion using sc delete, as they do not have to be deleted immediately/synchronously.
Now I am wondering about the installation process. The order of calls is such:
net stop service1
net stop service2
sc config service1 depend=dependency1
sc config service2 depend=dependency2
sc start service1
sc start service2
Is there an intrinsic order to queries passed to sc? Are they worked through in the order sc is called (I assume they are not)? Are they being delegated to the respective service and queued there (this is what I hope for), e.g. whether service1 or service2 is stopped and configured first is ambiguous, but the sc config, sc start order is not? Is the order entirely ambiguous?
In addition I am curious to know what happens when mixing net and sc calls. Assume the following order:
net stop service
sc config service
net start service
Is it reasonable to assume that the service would likely be stopped, then started before any configuration occurred?
Supposedly the general question is, how to ensure proper service setup via concatenated sc/net calls. The required order:
Stop service (it may or may not exist on system)
Create service / conffigure service
Start service
Uninstallation is less pressing, because stopping services and flagging them for deletion is sufficient.
Mixing sc and net calls should not be a problem because it is the SCM (Service Control Manager) process that controls the services, other applications simply asks the SCM to perform a specific operation.
The documentation for the ChangeServiceConfig API function states that:
If the configuration is changed for a service that is running, with the exception of lpDisplayName, the changes do not take effect until the service is stopped.
This leads me to believe that a installer can use the following sequence:
Install/Configure --> Stop (synchronous) --> Start.
Performing "Stop --> Configure --> Start" is always going to have a race condition issue because another process might trigger a service start at the wrong time.
I have been trying to schedule spring cloud task via PCF scheduler, however I can't create a job from the app/task (following this documentation on the site - http://docs.pivotal.io/pcf-scheduler/1-1/using-jobs.html)
$ cf apps
name requested state instances memory disk urls
cloud-task stopped 0/1 750M 1G
$ cf services
name service plan bound apps
last operation
my-scheduler scheduler-for-pcf standard cloud-task
create succeeded
$ cf create-job cloud-task my-task-job ".java-buildpa
ck/open_jdk_jre/bin/java org.springframework.boot.loader.JarLauncher"
Creating job ←[33;1mmy-task-job←[0m for ←[33;1mcloud-task←[0m with command ←[33;1m.java-buildpack/open_jdk_jre/bin/java org.springframework.boot.loade
r.JarLauncher←[0m in org ←[33;1mglobal-sales-marketing-customer-experience←[0m / space ←[33;1m141349-dev←[0m as ←[33;1mzzh1bb←[0m
←[31;1mFAILED←[0m
The requested resource was not found.
Not Found
You must create an instance of the scheduler service in this space to use the scheduler service.
Not sure why the job creation command is not able to find the instance of scheduler service - Am I missing something here ?
Also, wondering if there is anything in spring-clould-data-flow that can schedule tasks.
From the output you should be able to create a job in that org/space.
Does the user (zzh1bb?) have SpaceDeveloper privileges? SpaceAdmin should also be sufficient.
Does a cf task execute successfully using:
cf run-task cloud-task ".java-buildpack/open_jdk_jre/bin/java org.springframework.boot.loader.JarLauncher"
And seeing results with:
cf tasks cloud-task
Another diagnostic step might be to check the output of the api calls described here:
http://docs.pivotal.io/pcf-scheduler/1-1/api/#create-job
What version of PCF are you using and what version of the Scheduler for PCF are you using? There were significant changes in the cloud controller api between 1.10, 1.11 and 1.12 that prevent the scheduler service from working across all of those versions.
As far as scheduling SCDF, the Scheduler for PCF service can be used in conjunction with SCDF to allow you to call the task execution endpoint from a Schedeler for PCF call (https://docs.pivotal.io/pcf-scheduler/1-1/using-calls.html).
Call SCDF using the execution endpoint
http://...scdf server.../tasks/executions?name=taskA
doc'ed here:
https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_launching_a_task_2
This is very useful and convenient especially when creating the SCDF service and the Scheduler for PCF service in the same space.
I am running the Spring-Boot application as a Windows service.I can see my services is listed in the MSCONFIG
I wanted to know how can I
Stop
Start
Delete
The Service.
You can't perform those operations from MSCONFIG. Use the services control panel application (services.msc) to start, stop and generally manage your service. Use the SC command line utility to delete your service ("SC DELETE service-name").