Yellowfin As Linux Service

Yellowfin FAQ shared this question 3 weeks ago
Answered

Is it possible to install Yellowfin as a Linux service?

Best Answer
photo

This can be done post-installation and is quite easy using systemd. Following is an example service file, i.e. yellowfin.service:

[Unit]
Description=Yellowfin
After=network.target

[Service]
Type=forking
User=yellowfin
ExecStart=/opt/Yellowfin/appserver/bin/startup.sh
ExecStop=/opt/Yellowfin/appserver/bin/shutdown.sh
Restart=on-failure
WorkingDirectory=/opt/Yellowfin

[Install]
WantedBy=multi-user.target
Alias=yellowfin.service
Note you will want to adapt this to reflect your environment as needed. This yellowfin.service file can be added to /etc/systemd/system/ to allow it to be called as a service.

Comments (2)

photo
1

This can be done post-installation and is quite easy using systemd. Following is an example service file, i.e. yellowfin.service:

[Unit]
Description=Yellowfin
After=network.target

[Service]
Type=forking
User=yellowfin
ExecStart=/opt/Yellowfin/appserver/bin/startup.sh
ExecStop=/opt/Yellowfin/appserver/bin/shutdown.sh
Restart=on-failure
WorkingDirectory=/opt/Yellowfin

[Install]
WantedBy=multi-user.target
Alias=yellowfin.service
Note you will want to adapt this to reflect your environment as needed. This yellowfin.service file can be added to /etc/systemd/system/ to allow it to be called as a service.

photo
1

For System V create /etc/init.d/yellowfin:

#!/bin/bash
#
# chkconfig: 2345 99 5
#

# Get function from functions library
. /etc/init.d/functions

# Start the service Yellowfin
start() {
	initlog -c "echo -n Starting Yellowfin service:"
	/opt/Yellowfin/appserver/bin/startup.sh &
	### Create the lock file ###
	touch /var/lock/subsys/Yellowfin
	success $"Yellowfin server startup"
	echo
}

# Restart the service Yellowfin
stop() {
	initlog -c "echo -n Stopping Yellowfin server: "
	killproc Yellowfin
	### Now, delete the lock file ###
	rm -f /var/lock/subsys/Yellowfin
	/opt/Yellowfin/appserver/bin/shutdown.sh
	echo
}

### main logic ###
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	status)
		status Yellowfin
		;;
	restart|reload|condrestart)
		stop
		start
		;;
	*)
		echo #"Usage: $0 {start|stop|restart|reload|status}"
		exit 1
esac

exit 0

Next you'll want to symlink this to enable start on boot:

ln -s /etc/init.d/yellowfin /etc/rc3.d
and finally add it to chkconfig:

chkconfig --add yellowfin
Keep in mind these commands all require root privileges.

You can now issue service calls to Yellowfin:

service yellowfin {start|stop|restart}