Within the world of Linux, it is a common practice to bootstrap and manage processes. While there are several different methods to do so, systemd remains one of the more popular options. Briefly stated, systemd is an init system that is used to bootstrap user processes. Arguably, its most important component is the “system and service manager” component.
For Linux distros that support it, systemd can greatly benefit system administrative workflows. ArcGIS Enterprise on Linux makes use of systemd and in this Monthly Linux Tip, we will cover taking the ArcGIS Server unit file and implementing into systemd. Please find the table of contents below:
- Locating the unit file
- Copying unit file to systemd
- Enabling and starting services
Please note that in this blog, I am utilizing a RHEL 8.x machine to demonstrate. However, these steps should work so long as your system is configured with systemd.
1. Locating the unit file
Firstly, what is a unit file? Unit files describe the configuration on how that particular service will work within systemd. ArcGIS Enterprise on Linux comes built with unit files that will stop and start the service. These are found in the following location: <ArcGIS Installation Directory>/framework/etc/scripts/*.service.
In the case of ArcGIS Server, this could look like the following: /testpath/arcgis/server/framework/etc/scripts/arcgisserver.service.
2. Copying unit file to systemd
Now that we have located the unit file, it is time to copy it over to systemd. This can be done as illustrated below:
Simple! To ensure tightened security on that service, we will need to change the permissions from 700 to 600. See below on how to do so:
Notice how we verified the permissions after we changed the permissions. This is to ensure that our changes went into effect. Please note that by design, the root user has user AND group ownership of the /etc folder. Due to this, you will need to use sudo when copying the service and changing the permissions. Alternatively, if you are the administrator of your machine, just use the root user directly and bypass using the sudo command.
3. Enabling and starting services
All that is left is to activate our service! This can be done in a few simple commands, shown below:
To break the above down, we are first enabling the service we are copying over. This means that we wish to enable this ArcGIS Server whenever we boot this machine. From there, we stop the service and then start it up. Once done, we can check on the status of the service to see if it is loaded or not.
With system and service managers, automating shutdown and startup may come of interest. The steps that we have done here can easily be put in a Bash script to help automate this process. An example is we can have a Bash script named enterprise-services.sh that looks like the following:
Should the environment have Portal for ArcGIS, ArcGIS Data Store, etc, this Bash script can extend to account for those services.
In this blog, we discussed copying unit files within ArcGIS Server into systemd, enabling and starting the service and how we can help automate this process. Please leave a comment in the comment section if this was of use to you. Also, let me know a topic you would love to see next month. Thank you for reading this Monthly Linux Tip and Happy New Years!