Setup Floating License Server as System Service on Linux
You can setup the Floating License Server as Linux system service. By setting up the server as service, it will start automatically when your machine boots up. This article will show you how to setup the floating license server as Linux system service.
- Setup license server beforehand. For those who want to know more about installing license server, please refer to Install floating license server article. It is supposed that the server is named as VPFloatingLicenseServer
- Prepare Service Script. A service script is used to be called by your OS when your computer is started. Go to /etc/init.d folder and create the service file vpflsd.
- The following is content of the script file, you are required to input the correct path into VPFLS_HOME (i.e. /etc/VPFloatingLicenseServer):
#!/bin/sh
# Source function library.
. /etc/rc.d/init.d/functions
#SET THE FOLLOWING LINE TO YOUR CORRECT VPFLS_HOME
export VPFLS_HOME=/etc/VPFloatingLicenseServer
export TOMCAT_HOME=$VPFLS_HOME/webserver
export JRE_HOME=$VPFLS_HOME/jre
export PATH=$PATH:$TOMCAT_HOME/bin:$JRE_HOME/bin
export HOME=/root/#IF YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH
#AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE
#export CLASSPATH=start() {
cd $TOMCAT_HOME/bin
echo -n “Starting tomcat daemon: ”
daemon $TOMCAT_HOME/bin/startup.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat
}stop() {
echo -n “Stopping tomcat daemon: ”
daemon $TOMCAT_HOME/bin/shutdown.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tomcat
sleep 4
}RETVAL=0# See how we were called.
case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
esacYou can download the sample service script file at the bottom of the page.
- Grant execute permission to service script. You can execute the command chmod +X vpflsdto grant execute permission to the script file.
- Create Symbolic Link into runlevel folder (rcX.d). Once you ready the service script, you can then define symbolic link in runlevel folder for launching the script. You first have to check what is your run level by reading the file /etc/init/rc-sysinit.conf. From the rc-sysinit.conf we know that our default runlevel is 2, that means the runlevel folder is rc2.d.
*Note that different Linux may use different comment to lookup the default run level. - Go to /etc/rc2.d, and there are a list of files, and their names are starts with Sxx (where xx is a number, the smaller number, higher priority on being called). You need to create a Sxx symbolic link to start and stop license server. i.e. execute the command to create the symbolic links: ln -s ../init.d/vpflsd S99vpflsd
- Now, Floating License Server will be started or stopped when your computer is started/shutdown.
Download sample service script
Download sample service script
Details about setup floating license server as system service on Mac can be found here.
This fails on Ubuntu.
● vpflsd.service
Loaded: loaded (/etc/init.d/vpflsd; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-03-07 09:03:56 MST; 2min 1s ago
Docs: man:systemd-sysv-generator(8)
Process: 1862 ExecStart=/etc/init.d/vpflsd start (code=exited, status=2)
Mar 07 09:03:56 ip-192-168-41-184 systemd[1]: Starting vpflsd.service…
Mar 07 09:03:56 ip-192-168-41-184 vpflsd[1862]: “Starting tomcat daemon: ”daemon: fatal: refusing to execute unsafe program: /opt/VPServer/webserver/bin/startup.sh (/opt/VPServer is group writable)
Mar 07 09:03:56 ip-192-168-41-184 vpflsd[1862]: /etc/init.d/vpflsd: 19: /etc/init.d/vpflsd: Syntax error: Bad function name
Mar 07 09:03:56 ip-192-168-41-184 systemd[1]: vpflsd.service: Control process exited, code=exited status=2
Mar 07 09:03:56 ip-192-168-41-184 systemd[1]: Failed to start vpflsd.service.
Mar 07 09:03:56 ip-192-168-41-184 systemd[1]: vpflsd.service: Unit entered failed state.
Mar 07 09:03:56 ip-192-168-41-184 systemd[1]: vpflsd.service: Failed with result ‘exit-code’.