Configure Code Insight as a Linux Service

Code Insight 6.14.2 SP2

Perform the following procedure to run Code Insight as a Linux service.

To run Code Insight as a service in Linux, do the following:

1. Create a file named CodeInsight.service with the following content.

[Unit]
Description=Tomcat Service CodeInsight.service
After=syslog.target network.target


[Service]
User=<userId>

WorkingDirectory=<codeInsight_install_path>
Type=forking
ExecStart=<codeInsight_install_path>tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID
LimitNOFILE=65536


[Install]
WantedBy=multi-user.target

Note the following:

The CodeInsight.service file name is case-sensitive when referenced in the file content.
The <userId> value for the User property is the user ID that will run the Code Insight service. This user ID should not run under elevated privileges.
For Ubuntu, this should be the user ID that installed Code Insight (not the root user).
For RedHat and CentOS, this should be a user ID with non-elevated privileges. You can ensure that such a user ID is used by explicitly including the User property in this file and specifying the appropriate ID. As an alternative, especially for cases where the user ID starts with a number, you can omit this property from the .service file and instead specify the ID using the login argument in the ExecStart command, as in the example:

ExecStart=/usr/bin/su --login <loginUserId> -c <codeInsight_install_path>tomcat/bin/startup.sh

2. Copy the CodeInsight.service file to the /etc/systemd/system directory:

$ sudo cp CodeInsight.service /etc/systemd/system

3. Stop the Tomcat server. See Configuring Code Insight for Single Sign-On (Optional).
4. Execute the following command to notify systemd that the Code Insight service has been added:

$ sudo systemctl daemon-reload

5. Use the following commands to start, stop, or restart the Code Insight service. (The CodeInsight.service file name is case-sensitive in the commands.)

$ sudo systemctl start CodeInsight.service
$ sudo systemctl stop CodeInsight.service
$ sudo systemctl restart CodeInsight.service

6. Execute the following command to enable the starting of Code Insight upon booting. (The CodeInsight.service file name is case-sensitive in this command.)

systemctl enable CodeInsight.service

From this point on, when you start your system, Code Insight will start up automatically.

Note:The LimitNOFILE value 65536, defined in the CodeInsight.service file in step 1 above, is the open-file limit required by Code Insight. Best practice is to also set this value for individual Code Insight users or groups as a backup should situations arise when Code Insight is not run as a service. See Setting the Open File Limit (Linux/Unix) for details.