here is an /etc/init.d/mingled file#271

Subscribe to here is an /etc/init.d/mingled file 4 post(s), 3 voice(s)

 
Avatar Cyber Golem 2 post(s) #642

Here is a file that can be used as /etc/init.d/mingled on most Linux installations. All you need to do is
chmod uog+rx /etc/init.d/mingled
/etc/init.d/mingled configure

The configure step adds a mingle user and sets things up so that mingled
will run at system startup after mysql and postgresql start up,
and shut down before those database servers shut down.

Might I suggest that the installation media include this as mingle/linux/etc/init.d/mingled in some future release.

Or provide it in an RPM installer.

!/bin/bash

#

  1. mingled This shell script takes care of starting and stopping
  2. the Mingle server. Start after mysql or postgresql. #
  3. chkconfig: – 65 35
  4. description: Mingle Project Management Server
  5. config: /usr/local/mingle/mingle.properties #
  6. Created: 31-AUG-2007, George J Carrette for Monster.Com.
  7. $Id: mingled,v 1.3 2007/08/31 11:56:40 gcarrett Exp $
  8. Note: This runs in RedHat Enterprise. # #
    MINGLE_HOME=/home/mingle
    MINGLE_ROOT=/usr/local/mingle
    MINGLE_USER=mingle
    MINGLE_GROUP=mingle
    export PATH=/usr/sbin:/sbin/:${PATH}
start(){
  1. we cd to this so that the nohup.out ends up in the log folder.
  2. Well, that does not work, unless you change the MingleServer
  3. retain its original working directory before doing the nohup call.
    cd ${MINGLE_ROOT}/log
    runuser ${MINGLE_USER} ${MINGLE_ROOT}/MingleServer start
    }

stop(){
cd ${MINGLE_ROOT}/log
runuser ${MINGLE_USER} ${MINGLE_ROOT}/MingleServer stop
}

status(){
cd ${MINGLE_ROOT}/log
ps -f -u ${MINGLE_USER}
runuser ${MINGLE_USER} ${MINGLE_ROOT}/MingleServer status
}

restart(){ stop start
}

configure() {
chkconfig—add mingled
chkconfig mingled on
chkconfig—list mingled
  1. This is assuming the default Linux behavior, which creates
  2. a user and a group by the same name.
    useradd—comment “Mingle Server”—home-dir ${MINGLE_HOME} ${MINGLE_USER}
    chmod g+rwx ${MINGLE_HOME}
    if [ ! -d ${MINGLE_ROOT}/log ]; then mkdir ${MINGLE_ROOT}/log chown ${MINGLE_USER}:${MINGLE_GROUP} ${MINGLE_ROOT}/log
    fi
    chmod g+rwx ${MINGLE_ROOT}/log
    ls -ld ${MINGLE_HOME} ${MINGLE_ROOT} ${MINGLE_ROOT}/log
    }
  1. See how we were called.
    case ”$1” in start) start ;; stop) stop ;; status) status ;; restart) restart ;; configure) configure ;; *) echo $”Usage: $0 {start|stop|status|restart|configure}” exit 1
    esac

exit $?

 
Avatar jawspeak 2 post(s) #653

I’d like to get this over in Debian (Ubuntu 6.06 LTS) ... I think I’ll need to use “su -mingle_username ${MINGLE_USER} ${MINGLE_ROOT}/MingleServer start” to start things up. (That or use su -c… I’ve got some more reading to do).

How about the chkconfig? I’ve got to figure out what that is debian’s system. I’ve been reading here [1], but if anyone has tips, please could you leave a post?

Thanks,

Jonathan
[1] http://www.debian.org/doc/debian-policy/ch-files.html#s-scripts

 
Avatar Barrow Kwan Administrator 10 post(s) #654

Here is what we use in RedHat/Fedora Core/CentOS, I think it will work for Debian/Ubuntu

Step to install/run this script:
1. Save this script under /etc/rc.d/init.d ( eg /etc/rc.d/init.d/mingle )
2. change the file permission ( eg chmod 755 /etc/rc.d/init.d/mingle )
3. create a file called mingle under /etc/sysconfig ( ie /etc/sysconfig/mingle ) with the following one line : MINGLE_USER=mingle * This is the user who will run mingle. Change it to the user who will run mingle in your environment ( I highly NOT recommend you run Mingle as root )
3. run ”/sbin/chkconfig mingle on” ( this will make mingle run automatically after server reboot and shutdown mingle during “normal” server shutdown )
4. to start mingle, you can run ”/sbin/service mingle start”
4a to stop mingle, you can run ”/sbin/service mingle stop”

/etc/rc.d/init.d/mingle :

!/bin/bash

#

  1. chkconfig: – 84 16
  2. description: JRuby Mingle #
  1. source function library
    . /etc/rc.d/init.d/functions
  1. pull in sysconfig settings
    if [ -f /etc/sysconfig/mingle ] ; then . /etc/sysconfig/mingle
    fi

[ -z ”$MINGLE_USER” ] && MINGLE_USER=nobody

RETVAL=0

start(){ su – $MINGLE_USER -c ”/export/users/mingle/mingle/MingleServer start”
}

stop(){ su – $MINGLE_USER -c ”/export/users/mingle/mingle/MingleServer stop”
}

case ”$1” in start) start ;; stop) stop ;; restart) stop start ;; *) echo $”Usage: $0 {start|stop|restart}” RETVAL=1
esac
exit $RETVAL

 
Avatar jawspeak 2 post(s) #655

Here’s what I settled with, it seems to work. (apologies for the funny formatting, here’s a pastie: http://pastie.caboo.se/94705)

  1. Create a mingle user: >sudo adduser mingle
  2. Download and install mingle (I installed it in /home/mingle/mingle), also create /var/mingle (and if needed >sudo chown -R mingle:mingle . )
  3. Create and install the following /etc/init.d/mingled script, using sudo update-rc.d mingled defaults 99 (this sets the run order to run after mysql, etc, which are 20), then sudo chmod +x /etc/init.d/mingled
    You may need to sudo apt-get install sysv-rc-conf #!/bin/bash
  4. description: JRuby Mingle #
  5. modified from thoughtworks studios script in the forums #
    MINGLE_USER=mingle
    [ -z ”$MINGLE_USER” ] && MINGLE_USER=nobody
    RETVAL=0
    start(){ su – $MINGLE_USER -c ”/home/mingle/mingle/MingleServer start”
    }
    stop(){ su – $MINGLE_USER -c ”/home/mingle/mingle/MingleServer stop”
    }
    case ”$1” in start) start ;; stop) stop ;; restart) stop start ;; *) echo $”Usage: $0 {start|stop|restart}” RETVAL=1
    esac
    exit $RETVAL

(you can also look at a sample /etc/init.d/scaffold script for help writing them)