:-), 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:
/etc/systemd/system/IAM.service
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
# StartLimitAction=reboot
[Service]
# 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
Type=simple
# 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:
- Add the DevTest User to /etc/sudoers so the user can run the IAM service
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..
Example,
[Unit]
Description=DevTest Solution Portal service
[Service]
Type=forking
ExecStart=/opt/CA/DevTest/bin/Portal
ExecStop=/opt/CA/DevTest/bin/PortalService stop
Before=RegistryService.service
[Install]
WantedBy=multi-user.target
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.