Running SCM Server in background

4,196 views
Skip to first unread message

Chohdry

unread,
Jul 5, 2011, 11:03:15 AM7/5/11
to scmmanager
Hi,

Can anybody recommend a way to run scm server in background and on
restart if needed on centos?

Thanks

Sebastian Sdorra

unread,
Jul 5, 2011, 11:13:41 AM7/5/11
to scmma...@googlegroups.com
Hi,
You can use the start and stop parameter of the scm-server (not
available on windows) e.g. ./scm-server start. The start parameter
starts the scm-manager as unix daemon.

Sebastian

2011/7/5 Chohdry <cho...@gmail.com>:

Sebastian Sdorra

unread,
Jul 5, 2011, 11:26:43 AM7/5/11
to scmma...@googlegroups.com
Hi,
Sorry, I forgot the init script. Put a script like the following in
/etc/init.d/scmserver:

#!/bin/sh
# chkconfig: 2345 90 10
# description: SCM-Server

SCM_SERVER="/opt/scm-server/bin/scm-server"

start() {
"$SCM_SERVER" start
}

stop() {
"$SCM_SERVER" stop
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac

Make it executable (chmod 755) and add it as centos service (chkconfig
--add scmserver).

Sebastian

2011/7/5 Sebastian Sdorra <s.sd...@gmail.com>:

Kamran Chohdry

unread,
Jul 7, 2011, 6:47:54 PM7/7/11
to scmma...@googlegroups.com
Hi Sebastian,

Thanks for detailed and prompt reply.
It was really helpful I was just missing a couple of things.
Specially was not aware of daemon mode with start command line param.

Only thing is that when I try running in daemon it comes back with following error?

/opt/scm-server/libexec/jsvc-linux-i686: error while loading shared libraries: libcap.so.2: cannot open shared object file: No such file or directory

Do you think I might need to update to latest version?
Also this reminds me wiki is missing some update instructions / best practices.

Regards,
Kamran Chohdry
http://chohdry.com
Message has been deleted

Sebastian Sdorra

unread,
Jul 8, 2011, 1:59:56 AM7/8/11
to scmma...@googlegroups.com
Hi,
Yes, you are right the wiki needs some updates. Which version of java
do you use Oracle/Sun or OpenJDK?

Sebastian

2011/7/8 Chohdry <cho...@gmail.com>:


> Hi Sebastian,
>
> Thanks for detailed and prompt reply.
> It was really helpful I was just missing a couple of things.
> Specially was not aware of daemon mode with start command line param.
>
> Only thing is that when I try running in daemon it comes back with
> following error?
>
> /opt/scm-server/libexec/jsvc-linux-i686: error while loading shared
> libraries: libcap.so.2: cannot open shared object file: No such file
> or directory
>
> Do you think I might need to update to latest version?
> Also this reminds me wiki is missing some update instructions / best
> practices.
>

> Thanks
> Chohdry

>> 2011/7/5 Sebastian Sdorra <s.sdo...@gmail.com>:


>>
>>
>>
>>
>>
>>
>>
>> > Hi,
>> > You can use the start and stop parameter of the scm-server (not
>> > available on windows) e.g. ./scm-server start. The start parameter
>> > starts the scm-manager as unix daemon.
>>
>> > Sebastian
>>

>> > 2011/7/5 Chohdry <choh...@gmail.com>:

Sebastian Sdorra

unread,
Jul 8, 2011, 3:58:34 AM7/8/11
to scmma...@googlegroups.com
Hi,
Could you post the output of this command "ldd
scm-server/libexec/jsvc-linux-i686"?

Sebastian

2011/7/8 Sebastian Sdorra <s.sd...@gmail.com>:

Kamran Chohdry

unread,
Jul 8, 2011, 7:52:19 AM7/8/11
to scmma...@googlegroups.com
Hi Sebastian,

ldd comes back with
ldd: scm-server/libexec/jsvc-linux-i686: No such file or directory

Java is OpenJDK

java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7.10) (rhel-1.21.b17.el5-i386)
OpenJDK Client VM (build 14.0-b16, mixed mode)


Regards,
Kamran Chohdry
http://chohdry.com



Sebastian Sdorra

unread,
Jul 8, 2011, 7:57:09 AM7/8/11
to scmma...@googlegroups.com
Hi,
Could you please execute the ldd command with the full path to the
scm-server/libexec/jsvc-linux-i686
e.g.: ldd /opt/scm-server/libexec/jsvc-linux-i686

Sebastian

2011/7/8 Kamran Chohdry <cho...@gmail.com>:

Kamran Chohdry

unread,
Jul 8, 2011, 7:58:53 AM7/8/11
to scmma...@googlegroups.com
Hi Sebastian,

Sorry did not notice the path there

here is right one.

        libdl.so.2 => /lib/libdl.so.2 (0xb7fb4000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7f9c000)
        libcap.so.2 => not found
        libc.so.6 => /lib/libc.so.6 (0xb7e58000)
        /lib/ld-linux.so.2 (0xb7fbd000)



Regards,
Kamran Chohdry
http://chohdry.com



Sebastian Sdorra

unread,
Jul 8, 2011, 8:02:11 AM7/8/11
to scmma...@googlegroups.com
Hi,
Could you please replace the jsvc-linux-i686 file with this one
http://download.scm-manager.org/thread/fb03637a751b9744/jsvc-linux-i686

Kamran Chohdry

unread,
Jul 8, 2011, 9:53:14 AM7/8/11
to scmma...@googlegroups.com
Hi,

I replaced the file however after that trying to start scm-server resulted in error "can not locate Java Home"
Checking echo $JAVA_HOME came back with blank, so had to

export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export PATH=$PATH:$JAVA_HOME/bin

Also added above to my bash profile by going to following and appending the above two lines
vi $HOME/.bash_profile

Would you recommend adding this path anywhere else or is it good enough place to leave?


Regards,
Kamran Chohdry
http://chohdry.com



Sebastian Sdorra

unread,
Jul 8, 2011, 3:17:36 PM7/8/11
to scmma...@googlegroups.com
Hi,
You could place the JAVA_HOME variable in scm-server start-script, but
your solution with the .bash_profile is very good because you don't
have to change the start-script again after an update.

Kamran Chohdry

unread,
Jul 12, 2011, 7:23:00 AM7/12/11
to scmma...@googlegroups.com
Hi,

Thanks very much Sebastian for your help, works like a treat.


Regards,
Kamran Chohdry
http://chohdry.com



Garrett Johnson

unread,
Jul 27, 2011, 4:43:30 PM7/27/11
to scmmanager
I'm having the same issue, but with the x86_64 version...

/opt/scm-server/libexec/jsvc-linux-x86_64: error while loading shared
libraries: libcap.so.2: cannot open shared object file: No such file
or directory

Do you have a replacement file for it too?


On Jul 8, 7:02 am, Sebastian Sdorra <s.sdo...@gmail.com> wrote:
> Hi,
> Could you please replace the jsvc-linux-i686 file with this onehttp://download.scm-manager.org/thread/fb03637a751b9744/jsvc-linux-i686
>
> Sebastian
>
> 2011/7/8 Kamran Chohdry <choh...@gmail.com>:
>
>
>
> > Hi Sebastian,
>
> > Sorry did not notice the path there
>
> > here is right one.
>
> >         libdl.so.2 => /lib/libdl.so.2 (0xb7fb4000)
> >         libpthread.so.0 => /lib/libpthread.so.0 (0xb7f9c000)
> >         libcap.so.2 => not found
> >         libc.so.6 => /lib/libc.so.6 (0xb7e58000)
> >         /lib/ld-linux.so.2 (0xb7fbd000)
>
> > Regards,
> > Kamran Chohdry
> >http://chohdry.com
>
> > On Fri, Jul 8, 2011 at 12:57, Sebastian Sdorra <s.sdo...@gmail.com> wrote:
>
> >> Hi,
> >> Could you please execute the ldd command with the full path to the
> >> scm-server/libexec/jsvc-linux-i686
> >> e.g.: ldd /opt/scm-server/libexec/jsvc-linux-i686
>
> >> Sebastian
>
> >> 2011/7/8 Kamran Chohdry <choh...@gmail.com>:
> >> > Hi Sebastian,
>
> >> > ldd comes back with
> >> > ldd: scm-server/libexec/jsvc-linux-i686: No such file or directory
>
> >> > Java is OpenJDK
>
> >> > java version "1.6.0_17"
> >> > OpenJDK Runtime Environment (IcedTea6 1.7.10) (rhel-1.21.b17.el5-i386)
> >> > OpenJDK Client VM (build 14.0-b16, mixed mode)
>
> >> > Regards,
> >> > Kamran Chohdry
> >> >http://chohdry.com
>
> >> > On Fri, Jul 8, 2011 at 08:58, Sebastian Sdorra <s.sdo...@gmail.com>
> >> > wrote:
>
> >> >> Hi,
> >> >> Could you post the output of this command "ldd
> >> >> scm-server/libexec/jsvc-linux-i686"?
>
> >> >> Sebastian
>
> >> >> 2011/7/8 Sebastian Sdorra <s.sdo...@gmail.com>:
> >> >> > Hi,
> >> >> > Yes, you are right the wiki needs some updates. Which version of java
> >> >> > do you use Oracle/Sun or OpenJDK?
>
> >> >> > Sebastian
>
> >> >> > 2011/7/8 Chohdry <choh...@gmail.com>:

Sebastian Sdorra

unread,
Jul 28, 2011, 5:32:00 AM7/28/11
to scmma...@googlegroups.com
Hi,
You could test this file
http://download.scm-manager.org/thread/fb03637a751b9744/jsvc-linux-x86_64

Sebastian

2011/7/27 Garrett Johnson <garre...@gmail.com>:

Garrett Johnson

unread,
Jul 28, 2011, 11:57:48 AM7/28/11
to scmmanager
Works good. Thank you for your help and this awesome piece of
software.

On Jul 28, 4:32 am, Sebastian Sdorra <s.sdo...@gmail.com> wrote:
> Hi,
> You could test this filehttp://download.scm-manager.org/thread/fb03637a751b9744/jsvc-linux-x8...
>
> Sebastian
>
> 2011/7/27 Garrett Johnson <garrettr...@gmail.com>:

Peter Nicolai

unread,
Sep 1, 2011, 1:06:45 PM9/1/11
to scmma...@googlegroups.com
I'm trying to use this script on Ubuntu using update-rc.d instead of chkconfig. Trying to start the service, even as root, fails with "Permission denied" at the last line of the script (the "esac"). Any ideas??


Peter Nicolai

unread,
Sep 1, 2011, 3:17:49 PM9/1/11
to scmma...@googlegroups.com
Never mind, typo in the script..

JavaNode

unread,
Sep 7, 2011, 6:42:16 AM9/7/11
to scmma...@googlegroups.com
Debian script.This is alternative solution if jsvc.exec doesn't work or you don't want to use it.
you have to create scmserver user first.

add this script to /etc/init.d/
and then
update-rc.d -f  scmadmin default - add it tu default run levels
update-rc.d -f  scmserver remove - remove from run levels

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          scmserver
# Required-Start:    $remote_fs $syslog $network
# Required-Stop:     $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start scmserver at boot time
# Description:       Control Repositories
### END INIT INFO



# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi

# Check for and source configuration file otherwise set defaults
RETVAL=0

appname=ScmServerDaemon

# See how we were called.
start() {
    # Call the tomcat init script as our user
    /bin/su - scmserver -c "/opt/scm-server/bin/scm-server start >> /opt/scm-home/logs/scm-manager-output.log 2>&1 & "
}

stop() {
    if [ ! status = 0 ]
    then
          #SCM_PID=$( ps auxwww | grep  java | grep ${appname} | awk '{ print $2 }' )
          kill -9 $SCM_PID
    else
      echo "SCM is not running"
    fi
}

status() {
    ps auxwww | grep  java | grep ${appname} || echo "SCM is not running"
}

restart() {
    stop
    SECONDS=0
    STAT=$( ps auxwww | grep  java | grep ${appname} |  wc -l )
    while [ $STAT -ne 0 ]
    do
      sleep 3
        if [ $SECONDS -gt 300 ]
        then
          SCM_PID=$( ps auxwww | grep  java | grep ${appname} | awk '{ print $2 }' )
          kill -9 $SCM_PID
        fi
      STAT=$( ps auxwww | grep  java | grep ${appname} |  wc -l )
    done
    start
}

# See how we were called.

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        status
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $RETVAL

JavaNode

unread,
Sep 7, 2011, 6:45:38 AM9/7/11
to scmma...@googlegroups.com
btw why when I use /scm-server start it is running 2 processes ?

Sebastian Sdorra

unread,
Sep 7, 2011, 6:57:41 AM9/7/11
to scmma...@googlegroups.com
Yes, this correct. Have a look at the "How jsvc works" part of
http://commons.apache.org/daemon/jsvc.html

2011/9/7 JavaNode <yura....@gmail.com>:

Andrey Kozhyn

unread,
May 23, 2012, 4:09:52 AM5/23/12
to scmma...@googlegroups.com
So its not possible on windows?

среда, 7 сентября 2011 г., 13:57:41 UTC+3 пользователь Sebastian Sdorra написал:

Sebastian Sdorra

unread,
May 23, 2012, 4:23:54 AM5/23/12
to scmma...@googlegroups.com
Hi,
You could install scm-manager as windows serice. Execute the following
command as administrator:

scm-manager.bat install

After that you should be able to start and stop the service over the
windows service console.

Sebastian

2012/5/23 Andrey Kozhyn <hed...@gmail.com>:

Yeukhon Wong

unread,
Jan 24, 2013, 7:06:32 PM1/24/13
to scmma...@googlegroups.com
Just an update for debian and ubuntu users.

You probably want to install these

and in your ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/jre
export PATH=$PATH:$JAVA_HOME/bin

I also suggest to just put it in /etc/environment
For certain deployment/configuration tool, they don't source your bashrc so it's better just add this one line to environment file directly.
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/jre
Reply all
Reply to author
Forward
0 new messages