Coldfusion 2018 systemd setup

New Here ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

I'm looking for instruction for setting up CF2018 as a systemd service.  I found a script called cf-init-run.sh and it created the service file but the file that the service file references "sysinit" does not exist.  

 

Any idea as to how this file gets created or if it's other file renamed ?  Or perhaps another script that is supposed to create it.

Any help would be greatly apperciated.  Thank you

TOPICS
Advanced techniques, Documentation, Getting started, Server administration

Views

868

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

You didn't specify what OS you are running, but with RedHat, the systemd script is, by default (if selected during installation), linked to /etc/systemd/system/cf2018.service. You may need to simply execute 'systemctl enable cf2018'.

 

You can always manually create the script and enable it:

[Unit]
Description=Adobe ColdFusion 2018
After=multi-user.target

[Service]
ExecStart=[install path]/cfusion/bin/../bin/sysinit start
ExecStop=[install path]/cfusion/bin/../bin/sysinit stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

 

These links may help:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_...

https://wiki.ubuntu.com/SystemdForUpstartUsers

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

OS is SUSE 15 SP1,  The systemd script is not the problem.  The program it execute is.  sysinit  does not exist on my install.  I have no idea why it's missing or how to create if that is required.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

The sysinit was deprecated with version 12: https://www.suse.com/media/white-paper/systemd_in_suse_linux_enterprise_12_white_paper.pdf

 

Perhaps there is some confusion about the 'sysinit' script provided by ColdFusion ($CF_DIR/bin/sysinit) which is copied to the appropriate startup directory vs the OS sysinit command. For suse, I believe the init scripts are located at /etc/init.d/.

 

When you look at the contents of /etc/init.d, do you see a ColdFusion script? If so, what does the 'systemctl status [script name]' return? If there is no script, try copying '$CF_DIR/bin/sysinit' to '/etc/init.d' and executing 'systemctl start [script name]'.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

 '$CF_DIR/bin/sysinit' 

Does not exist.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

Going back to the original question, you said the service file was created. Beyond creation of that script, the cf-init-run.sh script doesn't do anything. What is the contents and location of the systemd script that was created and what errors are you receiving?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

[Unit]
Description=Adobe ColdFusion 2018
After=multi-user.target

[Service]
ExecStart=/opt/coldfusion2018/cfusion/bin/../bin/sysinit start
ExecStop=/opt/coldfusion2018/cfusion/bin/../bin/sysinit stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

Have you checked the install log in the /opt/coldfusion2018/ directory? Maybe you need to reinstall. Here are the contents of the sysinit file in case that is the only thing missing.

 

#!/bin/bash

# chkconfig: 345 90 14
# description: starts the ColdFusion server

CF_DIR=/opt/coldfusion2018/cfusion
env "application.home=$CF_DIR" > /dev/null 2>&1


PATH=/usr/xpg4/bin:/bin:/sbin:/usr/bin:/usr/sbin:$CF_DIR/node/bin:$PATH
CONNECTOR=""
RUNTIME_USER=""cfusion""
#DOCROOT="$CF_DIR/wwwroot"

if [ "`uname`" != "SunOS" ]; then
string1=$(grep -o 'logDirectory[^"]*' $CF_DIR/lib/neo-logging.xml)
searchstring="</string>"

temp=${string1%$searchstring*}   # this means everything after "and" will be inserted into temp

CF_LOG_DIR=$(echo $temp | sed -e 's/\<logDirectory\>//g' | sed -e 's/\<string\>//g' | sed 's/[^a-z  A-Z 0-9  /]//g')
fi

 if [ "$CF_LOG_DIR" = "" ]; then
        CF_LOG_DIR=$CF_DIR/logs
     else
        #echo "Do nothing"
        :
 fi

IS_RUNNING="false"
IS_MAC="false"
VERSION="ColdFusion 2018"
SPACE=" "

CLASSPATH=$CF_DIR/runtime/bin/tomcat-juli.jar:$CF_DIR/bin/cf-bootstrap.jar:$CF_DIR/bin/cf-startup.jar:$CF_DIR/runtime/lib/'*'
JVMCONFIG=$CF_DIR/bin/jvm.config

. $CF_DIR/bin/parseargs $JVMCONFIG

CLASSPATH=$CLASSPATH:$JAVA_CLASSPATH
JAVA_LIBRARY_PATH=$JAVA_LIBRARYPATH

 if [ "$JAVA_HOME" = "" ]; then
        JAVA_EXECUTABLE="java"
    else
       JAVA_EXECUTABLE="$JAVA_HOME/bin/java"
 fi


#Get the server instance name 
arr=$(echo $CF_DIR | tr "/" "\n")
for x in $arr
do
    CF_INSTANCE_NAME="$x"
done

for word in $JVM_ARGS
do
 if [ "$word" != "-Xdebug" ]; then
        if [ ${word:0:9} != "-Xrunjdwp" ]; then
            JVM_ARGS_NODEBUG="$JVM_ARGS_NODEBUG$SPACE$word"
        fi
fi
done


ID=`id -u`

if [ "`uname`" = "Darwin" ]; then
  # nothing, on OSX we don't care about the user name.  We assume that the user running it has permission to do everything
  IS_MAC="true" 
  if [ -f "$CF_DIR/bin/cf-connectors.sh" ]
  then
   if [ ! $ID -eq 0 ]; then
	 echo 'You must be the root user to configure the ColdFusion connector. Start ColdFusion as "sudo ./coldfusion start" to configure connector.'
	 echo 'Once connector has been configured, start ColdFusion as "./coldfusion start" to run ColdFusion as non-root user.'
	 exit 1
   fi
  fi
  #Configure ColdFusion to start on system init.
  if [ -f "$CF_DIR/bin/cf-init.sh" ]
  then
    if [ ! $ID -eq 0 ]; then
    echo 'You must be the root user to configure the ColdFusion to start on System boot. Start ColdFusion as "sudo ./coldfusion start" to configure.'
	echo 'Once it has been configured, start ColdFusion as "./coldfusion start" to run ColdFusion as non-root user.'
    exit 1 
    fi
  fi
  
 elif [ ! $ID -eq 0 ]; then
	echo "You must be root to start ColdFusion."
	exit 1
fi

cfrunning() {
    IS_RUNNING="false"
    if [ $OS = "Solaris" ]; then
        # The comm output on Solaris includes the full path
        $PSCMD | fgrep $CF_DIR |fgrep java > /dev/null 2>&1
    else
        # other platforms have only the executable name
        $PSCMD | fgrep java | grep -v grep | grep com.adobe.coldfusion.bootstrap.Bootstrap | grep "start" | grep -w $CF_DIR > /dev/null 2>&1
    fi
    if [ $? -eq 0 ]; then
        IS_RUNNING="true"
    fi
}


cfstart() {

        [ -f "$CF_DIR/bin/cf-connectors.sh" ] && {

                echo "======================================================================"
                echo "Running the $VERSION connector wizard"
                echo "======================================================================"

                sh $CF_DIR/bin/cf-connectors.sh && {
                        mv -f $CF_DIR/bin/cf-connectors.sh $CF_DIR/bin/cf-connectors-run.sh
                                
				if [ "`uname`" = "Darwin" ]; then
				echo "======================================================================"
				echo 'Connector has been configured. Start ColdFusion as "./coldfusion start" to run ColdFusion as non-root user.'
				echo "======================================================================"
				fi
                }
				#install the cf-init script on first launch as root user.               
		[ -f "$CF_DIR/bin/cf-init.sh" ] && {

                echo "======================================================================"
                echo "Configuring $VERSION to start on system init."
                echo "======================================================================"

                sh $CF_DIR/bin/cf-init.sh install && {
                        mv -f $CF_DIR/bin/cf-init.sh $CF_DIR/bin/cf-init-run.sh				
                 }
                }
		                if [ "`uname`" = "Darwin" ]; then
				echo "============================================================================"
				echo 'Start ColdFusion as "./coldfusion start" to run ColdFusion as non-root user.'
				echo "============================================================================"
				exit 1
				fi
        }
		
         #install the cf-init script on first launch as root user.
        [ -f "$CF_DIR/bin/cf-init.sh" ] && {

                echo "======================================================================"
                echo "Configuring $VERSION to start on system init."

                sh $CF_DIR/bin/cf-init.sh install && {
                        mv -f $CF_DIR/bin/cf-init.sh $CF_DIR/bin/cf-init-run.sh	
                echo "======================================================================"						
                echo 'Start ColdFusion on system boot has been configured. Start ColdFusion as "./coldfusion start" to run ColdFusion as non-root user.'
                }
			    echo "======================================================================"
				exit 1
        }
	# [ -f $CF_DIR/bin/jvm.config ] || {
		# ln -s $CF_DIR/runtime/bin/jvm.config $CF_DIR/bin/jvm.config
	# }

    cfrunning
    
    if [ "$IS_RUNNING" = "true" ]; then
		echo "$VERSION server is already running"
		echo exiting
		exit 2    
    fi


	echo "Starting $VERSION server ..."

	eval $CFSTART > /dev/null

	echo "The $VERSION server is starting up and will be available shortly."

	# Insert a sleep statement to give the server a few moments.

	sleep 7

        cfrunning
    
        if [ "$IS_RUNNING" = "false" ]; then
		echo "There has been an error starting $VERSION server, please check the logs."
		exit 1
        fi
		
	echo "======================================================================"
	echo "$VERSION server has been started."
	echo "$VERSION will write logs to $CF_LOG_DIR/coldfusion-out.log"
	echo "======================================================================"

}

cfstop() {

	cfrunning
		
	if [ "$IS_RUNNING" = "false" ]; then
		echo "$VERSION server does not seem to be currently running"
		return
	fi

	echo "Stopping $VERSION server, please wait"

	eval $CFSTOP

	sleep 10

	cfrunning
	
	if [ "$IS_RUNNING" = "true" ]; then
        if [ $OS = "Solaris" -a ! -f "/usr/ucb/ps" ]; then
            $PSCMD | fgrep java | fgrep $CF_DIR | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
        else
            # other platforms have only the executable name
            $PSCMD | fgrep java | grep -v grep | grep com.adobe.coldfusion.bootstrap.Bootstrap | grep "start" | grep -w $CF_DIR | awk '{print $2}' | sudo xargs kill -9 > /dev/null 2>&1
        fi
        sleep 2
	fi
	
	cfrunning
	
	if [ "$IS_RUNNING" = "true" ]; then
		echo "$VERSION server is not responding. You have to forcefully stop the following ColdFusion PIDs manually: "
        if [ $OS = "Solaris" ]; then
		    $PSCMD | fgrep java | fgrep $CF_DIR | awk '{print $2}'
        else
            # other platforms have only the executable name
    		$PSCMD | fgrep java | grep -v grep | grep com.adobe.coldfusion.bootstrap.Bootstrap | grep "start" | grep -w $CF_DIR | awk '{print $2}'
        fi
		echo exiting
		exit 1
	fi

	echo "$VERSION server has been stopped"
}

cfstatus()
{
  eval $CFSTATUS    
}

case `uname` in

	SunOS)
		OS=Solaris
		if [  -f "/usr/ucb/ps" ]; then
			PSCMD="/usr/ucb/ps -auxww"
		else
			PSCMD="ps auxww"
		fi
                JAVA_EXECUTABLE="$JAVA_HOME/bin/java"
                LD_LIBRARY_PATH="$CF_DIR/lib:$CF_DIR/lib/_solaris:$JAVA_LIBRARY_PATH"
		CFSTART='su $RUNTIME_USER -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH $JVM_ARGS com.adobe.coldfusion.bootstrap.Bootstrap -start &"'
		CFSTOP='su $RUNTIME_USER -c "cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH  -Dcoldfusion.home=$CF_DIR com.adobe.coldfusion.bootstrap.Bootstrap -stop"'
        CFSTATUS='su $RUNTIME_USER -c "cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH -Dcoldfusion.home=$CF_DIR  com.adobe.coldfusion.bootstrap.Bootstrap -status"'
	;;

	Darwin)
		OS=Darwin
		PSCMD="ps -ef"
		LD_LIBRARY_PATH="$CF_DIR/lib:$JAVA_LIBRARY_PATH"
		CFSTART='LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export LD_LIBRARY_PATH;cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH $JVM_ARGS -Djava.library.path=$LD_LIBRARY_PATH com.adobe.coldfusion.bootstrap.Bootstrap -start&'
		CFSTOP='env -i; cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH -Dcoldfusion.home=$CF_DIR  com.adobe.coldfusion.bootstrap.Bootstrap -stop'
         CFSTATUS='su $RUNTIME_USER -c "cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH -Dcoldfusion.home=$CF_DIR  com.adobe.coldfusion.bootstrap.Bootstrap -status"'
	;;

	Linux)
		OS=Linux
		PSCMD="ps -efww"
	        if [ "`arch`" = "x86_64" ]; then
                   LD_LIBRARY_PATH="$CF_DIR/lib:$CF_DIR/lib/_linux64:$JAVA_LIBRARY_PATH"
                else
                  LD_LIBRARY_PATH="$CF_DIR/lib:$JAVA_LIBRARY_PATH"
                fi
		SUCMDFILE=su
		if [ -x /sbin/runuser ]; then
			SUCMDFILE=/sbin/runuser
		fi
		CFSTART='$SUCMDFILE -s /bin/sh $RUNTIME_USER -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH $JVM_ARGS com.adobe.coldfusion.bootstrap.Bootstrap -start &"'
		CFSTOP='$SUCMDFILE -s /bin/sh $RUNTIME_USER -c "env -i; cd $CF_DIR/bin;$JAVA_EXECUTABLE -classpath $CLASSPATH -Dcoldfusion.home=$CF_DIR com.adobe.coldfusion.bootstrap.Bootstrap -stop"'
		CFSTATUS='$SUCMDFILE -s /bin/sh $RUNTIME_USER -c "cd $CF_DIR/bin; $JAVA_EXECUTABLE -classpath $CLASSPATH -Dcoldfusion.home=$CF_DIR com.adobe.coldfusion.bootstrap.Bootstrap -status"'
	;;

	*)
		echo "Your OS: `uname` is unsupported"
		echo "exiting"
		exit 1
	;;

esac

ARG=$1

[ -z "$ARG" ] && ARG=usage

case $ARG in

	start)
		cfstart
	;;

	stop)
		cfstop
	;;

	restart)
		echo "Restarting $VERSION server ..."
		cfstop
		cfstart
	;;

	status)
		cfstatus
	;;

	wsconfig)
		WSCONFIG_JAR=$CF_DIR/runtime/lib/wsconfig.jar

		if [ $# -eq 0 ]; then
			# no arguments so display built-in help from wsconfig.jar
			$JAVA_EXECUTABLE -jar $WSCONFIG_JAR -help
			break
		else
			# brief help
			if [ "$2" = "help" ]; then
				echo "To configure a webserver connector you must specify the -ws and -dir options."
				echo "If configuring Apache it is recomended that you also specify the -bin and "
				echo "-script options."
				echo ""
				echo "To list all configured webserver connectors use the -list option."
				echo "To remove a configured webserver connector use the -r option with the "
				echo "-ws and -dir options."
				echo "To remove all webserver connectors use the -uninstall option."
				echo "To upgrade all installed webserver connectors use the -upgrade option."
				echo ""
				echo "For more detailed help see $0 $1."
			fi
			break
		fi

		# pass on all args to wsconfig.jar
		shift
		$JAVA_EXECUTABLE -jar $WSCONFIG_JAR $@ -coldfusion
	;;

	*)
		echo "Usage:$0 (start|stop|restart|status|wsconfig)"
	;;

esac


exit 0

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2019 Dec 30, 2019

Copy link to clipboard

Copied

LATEST

Well that is interesting because this file does exist but it's called coldfusion not sysinit.

 

Thanks for the info.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines