Installing the Talend CommandLine
service on RedHat/CentOS 6 Systems
Procedure
Create/Copy the following script to the
/etc/init.d/commandline file:
#!/bin/sh
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be placed in /etc/init.d.
### END INIT INFO
# Author: jsd03
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
COMMANDLINE=/oa/talend/commandline303
CMD_WORKSPACE=$COMMANDLINE"/commandline-workspace"
STARTUP=commandline.sh
USER=cxp
NAME=commandline
PORT=10004
# Read configuration variable file if present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
echo -n $"Starting commandline service: "
su - $USER -c "rm -Rf $CMD_WORKSPACE"
su - $USER -c "cd $COMMANDLINE && screen -dmS cmdLine ./$STARTUP"
#screen -dmS cmdLine $DAEMON_START
RETVAL=$?
echo
}
#
# Function that stops the daemon/service
#
do_stop()
{
echo -n $"Stopping commandline service: "
su - $USER -c "( echo 'stopServer' ; sleep 2 ) | telnet localhost $PORT"
RETVAL=$?
echo
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac
exit 0
Edit the USER and COMMANDLINE
variable values in the script (with the dedicated user to run Talend CommandLine, and the Talend CommandLine path respectively).
Make sure that the script is executable by typing the following
command:
chmod 0755
/etc/init.d/commandline
Type in the following commands to add the service to your
system:
chkconfig --list
chkconfig --add commandline
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!