In a Linux Environment
Perform the following procedure to run Code Insight as a service on Linux (RHEL, CentOS, or Ubuntu).
To run Code Insight as a service in Linux, do the following:
- Create a file named
CodeInsight.servicewith 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
-
Note the following:
-
The
CodeInsight.servicefile name is case-sensitive when referenced in the file content. -
The
<userId>value for theUserproperty 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 RHEL 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
Userproperty 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.servicefile and instead specify the ID using theloginargument in theExecStartcommand, as in the example:
-
-
ExecStart=/usr/bin/su--login <loginUserId> -c<codeInsight_install_path>tomcat/bin/startup.sh
If the startup.sh file does not have EXECUTE permission, ensure that the Code Insight user that you specify to run the service has EXECUTE permission on this file.
-
Copy the
CodeInsight.servicefile to the/etc/systemd/systemdirectory:$ sudo cp CodeInsight.service /etc/systemd/system -
Stop the Tomcat server. See Enabling Secure HTTP Over SSL.
-
Execute the following command to notify systemd that the Code Insight service has been added:
$ sudo systemctl daemon-reload -
Use the following commands to start, stop, or restart the Code Insight service. (The
CodeInsight.servicefile name is case-sensitive in the commands.)$ sudo systemctl start CodeInsight.service
$ sudo systemctl stop CodeInsight.service
$ sudo systemctl restart CodeInsight.service -
Execute the following command to enable the starting of Code Insight upon booting. (The
CodeInsight.servicefile 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.
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 for Linux/Unix for details.