It's all about the answers!

Ask a question

Linux startup script


1
1
D B (2111) | asked Aug 18 '11, 5:18 p.m.
edited Nov 06 '12, 11:48 a.m. by Ralph Schoon (59.0k23642)
I am trying to setup CLM/RTC to startup when linux boots.
I haven't found any good documentation for it.

The only link I've found is:

https://www-304.ibm.com/support/docview.wss?uid=swg21425943 Which relates to RRC

I tried simplifying and modifying it to how it relates to my environment:


#!/bin/bash

#
# chkconfig: 35 90 12
# description: Rational Team Concert / Jazzserver
#

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

# Start the service Jazz server
start() {
# initlog -c "echo -n Starting Jazz server: "
/opt/IBM/JazzTeamServer/server/server.startup
success $"Jazz server startup"
echo
}

# stop the service RRC
stop() {
# initlog -c "echo -n Stopping Jazz server: "
/opt/IBM/JazzTeamServer/server/server.shutdown
echo
}

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

exit 0


then I installed it with "chkconfig jazz on"
I think by default the run levels were:
0:off 1:off 2:on 3:on 4:on 5:on 6:off

in this configuration, when accessing the website after a boot, the qm and rm applications failed to load, as if they were broken.
running server.shutdown and server.startup fixed them again

Thinking that maybe it ran too soon after boot I disabled runlevel 2
0:off 1:off 2:off 3:on 4:on 5:on 6:off
but this produces the same result

Disabling runlevel 3
0:off 1:off 2:off 3:off 4:on 5:on 6:off
The application/jazz server doesnt start at all.

Anyone have any ideas? or a better script?

Thanks

5 answers



permanent link
Jean-Michel Athane (671112) | answered Nov 06 '12, 7:26 a.m.
Hello Jazzmen,

I recently successfully used this setup with CLM 4.0.0.1 (Tomcat server, Derby DB) on Redhat 5.5 64bits:
  • my /etc/init.d/JazzTeamServer file (don't forget 'execute' permission) is following :

    #!/bin/sh
    #
    # chkconfig: - 99 01
    # description: IBM Rational Jazz Team Server
    #

    RETVAL=0

    # See how we were called.
    case "$1" in
      start)
        # avoid "to many open files" error
        ulimit -n 65536
        ulimit -u 10000
        # call standard startup script
        /opt/IBM/JazzTeamServer/server/server.startup
        ;;
      stop)
        # call standard shutdown script
        /opt/IBM/JazzTeamServer/server/server.shutdown
        ;;
      restart)
        # stop the server
        $0 stop
        # ensure that the server is completely down
        sleep 30
        # start the server
        $0 start
        ;;
      status)
        # call the repotools command that reports for server status
        # print only the latest line of command output (by sed processing)
        cd /opt/IBM/JazzTeamServer/server
        ./repotools-jts.sh -isServerRunning | sed -n -e '$p'
        ;;
      *)
        echo $"Usage: JazzTeamserver {start|stop|restart|status}"
        RETVAL=3
        ;;
    esac

    exit $RETVAL

  • declare the service using the graphical interface System > Administration > Server Settings > Services
    • Actions > Add Service - Service Name=JazzTeamServer
    • Check the box to make it active (left of the service name)
    • Don't forget to "Save" (top left button)

  • reboot
Hope that this will help .. and that I did not forget anything.


permanent link
D B (2111) | answered Aug 24 '11, 3:41 p.m.
I have tried again, using your recommendation Ralph and documentation for "Running in Apache Tomcat as a Windows service":

"If you are using Derby as the database for your Jazz Repository, edit the teamserver.properties file each application to make the DB location an absolute path. Substitute the app name variable with the appropriate application directory name, for example, jts, ccm, qm, rm:
Open the <JazzInstallDir>\server\conf\<app>\teamserver.properties file.
Change the com.ibm.team.repository.db.jdbc.location=conf/<app>/derby/repositoryDB entry to com.ibm.team.repository.db.jdbc.location=C:/PROGRA~1/IBM/JazzTeamServer/server/conf/<app>/derby/repositoryDB. Note the forward slash (/) in the path.
In addition to editing the teamserver.properties file, you must edit the log4j.properties file to make the log file path name absolute. Substitute the app name variable with the application directory names, for example, jts, ccm, qm, rm, admin and the app name.log variable with each application log file, for example, jts.log, ccm.log, qm.log, rm.log, admin.log:
Open the <JazzInstallDir>\server\conf\<app>\log4j.properties file.
Change the log4j.appender.file.File=logs/<app> entry to log4j.appender.file.File=C:/PROGRA~1/IBM/JazzTeamServer/server/logs/<app>. Note the forward slash (/) in the path. "

Replacing paths with linux absolute paths.

I modified these files:
server/conf/qm/teamserver.properties
server/conf/ccm/teamserver.properties
server/conf/jts/teamserver.properties

server/conf/admin/log4j.properties
server/conf/rm/log4j.properties
server/conf/qm/log4j.properties
server/conf/ccm/log4j.properties
server/conf/jts/log4j.properties


I then used the same script in the first post, and enabled it with chkconfig jazz on. I am seeing the server boot up and jazz starting. When I visit the website I see the login prompt, which is usual. Once logging in I either get "Loading..." and the website just hangs there or I see a webpage with random errors. Refreshing the page doesn't do anything, or I see different errors..." For example, 500 errors, dashboards are broken, etc. This is the same with jts/admin, qm/admin, and ccm/admin.

Does anyone have any other recommendation on how to get a Linux startup script working?

permanent link
D B (2111) | answered Aug 19 '11, 2:12 p.m.
I should probably have said that after the server loads (without autostarting jazz),
I can use /etc/init.d/jazz start and the jazzserver runs just fine.
So I don't think it would be an issues with relative/absolute paths in the teamserver.properties files when using the startup script.

Also, when I try to autostart it on boot. The server loads, Jazz starts, but website isn't fully accessible. I run /etc/init.d/jazz restart, and then it works just fine... that's what makes me think its more a matter of timing on startup or something along those lines.

I should note that I am testing this on a development server, and the database being used is derby. So it should get started when the jazzserver starts.

However,
I just now tried to modify the teamserver.properties files for ccm,jts,qm.

I changed
com.ibm.team.repository.db.jdbc.location
com.ibm.team.fulltext.indexLocation
com.ibm.team.datawarehouse.db.jdbc.location
to the absolute path
The results seem to be the same as before.

When I changed com.ibm.team.jfs.index.root.directory it seemed to prevent the server from loading.



Also, I'm not sure if this is related, but when I run the autostart script and I watch the catalina.out log, I see no error immediately after boot. But once I visit the website and I check the log I see:
java.util.zip.ZipException: Too many open files

My /etc/security/limits.conf file is already changed to:
* hard nofile 65536
* soft nofile 65536

and running
ulimit -n
results in
65536

If I run /etc/init.d/jazz restart at this point, and revisit the website. The website works, and I don't see any errors in the log file.

permanent link
Ralph Schoon (59.0k23642) | answered Aug 19 '11, 5:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I have done it once at zLinux at a customer site.
Some important things:

* There are relative paths for several components (index etc) in the teamserver.properties you need to make absolute. Since you run the startup script that should be it. If you look at the application logs you would nothce some warnings if you have relative paths still.
* I would test if starting the server with: /opt/IBM/JazzTeamServer/server/server.startup works. This is the situation in the init script and it is different from going to the /opt/IBM/JazzTeamServer/server/ folder and starting the script there.
* There might be other settings you'd need in your script. Please see: https://www-304.ibm.com/support/docview.wss?uid=swg21421929 this is for Windows, but it provides a clue what to look at.
* make sure the database is started before you start

permanent link
Rene Meyer (42913234) | answered Dec 05 '11, 2:22 p.m.
JAZZ DEVELOPER
Hello,

I use the following approach:
1. I do not run the whole JTS Tomcat as root user
2. After JTS installation/initial configuration as root I created an normal user rtcuser and chown for that user the whole /opt/.......JazzTeamServer directory
3. then I use the following startup script (works on Fedora & CentOS should work on RH, needs modification for Ubuntu, SLES)

#!/bin/sh

### BEGIN INIT INFO
# Provides: rtc
# Required-Start: $local_fs $network $syslog $db2
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rtc
# Description: rtc
### END INIT INFO

# Source function library
. /etc/rc.d/init.d/functions

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
SU=runuser
else
SU=su
fi

script_result=0

start() {
RTC_START=$"Starting rtc service: "
echo -n "$RTC_START"
$SU -l rtc -c "/opt/IBM/JazzTeamServer/server/server.startup"
ret=$?
if [ $ret -eq 0 ]
then
touch /var/lock/subsys/rtc
success "$RTC_START"
else
failure "$RTC_START"
script_result=1
fi
echo
}

stop() {
echo -n $"Stopping rtc service: "
$SU -l rtc -c "/opt/IBM/JazzTeamServer/server/server.shutdown"
ret=$?
if [ $ret -eq 0 ]
then
echo_success
else
echo_failure
script_result=1
fi
rm -f /var/lock/subsys/rtc
echo
}

checkrtcstate()
{
# check if rtc is running and listening on HTTPS
javagrep=(`netstat -tlp | grep https.*java`)
if [ -z $javagrep ];then
echo $"${base} is stopped"
return 3
else
# get the pid
pid=`netstat -tlp | grep https.*java | sed -e 's/ //g' | sed -e 's/^.*LISTEN\(.*\)\/java.*/\1/g'`
echo $"rtc (pid $pid) is running..."
return 0
fi
}


case "$1" in

start)
start
;;
stop)
stop
;;
status)
checkrtcstate
script_result=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
script_result=1

esac

exit $script_result

Your answer


Register or to post your answer.