Can someone share a template to write Systemd init processes when running DevTest Processes as Linux services?
Bumping this thread.
Found nothing in Communities or docops on this subject.
Does anyone have a sample template file for setting up IAM and/or DevTest services to run under systemd?
I have nothing for IAM but the below is for installing DevTest services on Linux. Example is for a Simulator (If it looks familiar then it is because you were there when we figured it out for this customer :-) )
Generic example of the service script:
# chkconfig: 2345 75 15
# description: casvSimulatorService4
### BEGIN INIT INFO
# Provides: casvSimulatorService4
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: CA SV Simulator Service 4 (runuser=casv)
### END INIT INFO
daemon --user=casv /u01/casv/sftw/bin/SimulatorService4 $1
Procedure for registering a service
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
casvSimulatorService3 0:off 1:off 2:on 3:on 4:on 5:on 6:off
casvSimulatorService4 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
:-), I remember that one -- ah, the memories...
This one is slightly different since systemd and configuration files are involved.
I am uncertain about the various config properties when using systemd rather than init.d.
PLEASE do not accept the following as an accurate script, but I think it might look something like this:
Using https://www.freedesktop.org/software/systemd/man/systemd.service.html# as a reference point:
Create a File, for example:
In the file, add the following
[Unit] # Description of the service Description=DevTest IAM Service
# Start the service after the network is ready After=network.target
# Use 0 to allow systemd to attempt to restart the service forever StartLimitIntervalSec=0
# Or, comment above and allow the defaults then ask systemd to restart the server if the limit is reached
# Not certain what Type option to use for IAM
# exec - service mgr considers unit started after the main svc binary is executed
# forking – service mgr considers that execstart will call fork() as part of startup (service daemonizes itself)
# simple – service mgr considers the unit started after forking to .sh file
# Restart the service if IAM exits for some positive or negative reason
# no - service will not be restarted
# on-success – service will restart on a clean exit code
# on-failure – service restarted when a non-zero exit code
# always - service is restarted regardless of clean exit
# 'always' may not be a good option here. Maybe you want the service to stop
# so someone can debug why it is stopping similar to when a VSE stops Restart=always
# set to 1 second to avoid undue stress on server if something goes wrong RestartSec=1
# RunAs user name for the service???
# replace with actual runas user as necessary User=devtest
# Path to the IAM startup script in Bin
# ARE THERE ANY ADDITIONAL ARGUMENTS REQUIRED HERE such as
# --cd /usr/devtest/bin
# or a file for PID output
# or do we need to add ‘start’ as a parameter and omit ‘.sh/? ExecStart=/path/to/IAM/bin/IdentityAccessManager.sh [Install]
# Not real clear on what this is WantedBy=multi-user.target
Command to run the service
systemctl start IAM or sudo systemctl start IAM
Command to install the configuration as a service.
systemctl enable IAM or sudo systemctl enable IAM
I believe some variation of the above script is necessary when running under systemd. Wondering if someone has done this and can verify that I am not missing something really important to prevent outages.
<<< UPDATE 1 Feb 2019 >>>
I received a note from product engineering indicating the above script is "OK".
Engineering suggested the option of:
No other suggestions were made
Engineering did not suggest changing the ExecStart and Type options to use the service and forking, respectively.
If someone tries this, please update findings here so we have confirmation of the solution.
<<< UPDATE 2 >>>
Client did some testing and found the following settings work for Enterprise Dashboard, Registry, Portal, etc..
Description=DevTest Solution Portal service
Current issue is that IAM does not start using these settings. We suspect it may have something to do with IAM starting two processes (PIDs) instead of one. Will update again if more information comes available. Current approach is to use init.d for IAM.
I understand. My init.d reply is off topic as I generalized your question as being a requirement to run the programs as services.
I haven't used systemd yet. So, just thinking out loud here, but for the DevTest services (Registry, VSE, Coordinator, ...) I would assume that you set ExecStart to the "Registry" executable (as an example) and not to "RegistryService". Because RegistryService is in itself an init.d compliant script, so all of the scripting in there is redundant. Not sure what you need to set "Exec" to, I would think "forking"? Because when executing "Registry" it eventually forks a java executable, that's the only process running in the end.
Good points. I raised the question with the engineering team. If I get an answer, I will post it here. Probably useful to many.
Retrieving data ...