CHips L MINI SHELL

CHips L pro

Current Path : /etc/rc.d/init.d/
Upload File :
Current File : //etc/rc.d/init.d/cpanel_dovecot_solr

#!/bin/bash
#
#   /etc/rc.d/init.d/cpanel-dovecot-solr
#
# Starts the solr daemon
#
# Note: should start before dovecot to setup the firewall
# chkconfig: - 35 35
# description: Solr for cPanel Dovecot
# processname: solr
# config: /etc/sysconfig/cpanel-dovecot-solr
# pidfile: /var/run/solr/master.pid

### BEGIN INIT INFO
# Provides: solr
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start: 
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop Apache Solr server
# Description: Dovecot is an IMAP server for Linux/UNIX-like systems,
#              written with security primarily in mind.  It also contains
#              a small POP3 server.
### END INIT INFO

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

unset JAVA_HOME

if [ -f /etc/sysconfig/cpanel-dovecot-solr -a $UID -eq 0 ]; then
    . /etc/sysconfig/cpanel-dovecot-solr
fi

RETVAL=0
prog="Apache Solr for cPanel Dovecot"
exec="/home/cpanelsolr/bin/solr"
config="/home/cpanelsolr/server/etc/webdefault.xml"
pidfile="/home/cpanelsolr/bin/solr-8984.pid"
lockfile="/var/lock/subsys/cpanel-dovecot-solr"

USER=cpanelsolr
SERVICE=cpanel-dovecot-solr
PIDFILE=$pidfile
REGEX='(?:^|\s+|\/)solr'

start() {
    [ $UID -eq 0 ] || exit 4
    [ -x $exec ] || exit 5
    [ -f $config ] || exit 6

  already_running $USER $SERVICE $PIDFILE $REGEX; RUNNING=$?
  if [ 0 = $RUNNING ]; then
    /usr/local/cpanel/3rdparty/scripts/cpanel_dovecot_solr_firewall start

    # -u = NPROC; -n = NOFILE
    ulimit -u 65000 -n 65000

    echo -n $"Starting $prog: "
    daemon --user=$USER --pidfile $pidfile SOLR_JAVA_HOME=${SOLR_JAVA_HOME} $exec start -noprompt -h ${SOLR_HOSTNAME} -p ${SOLR_PORT} -m ${SOLR_MEMORY} -a "${SOLR_JVM_OPTS}"
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch  $lockfile
    echo
  fi
}

stop() {
   [ $UID -eq 0 ] || exit 4
   echo -n $"Stopping $prog: "
   killproc -p $pidfile $exec
   RETVAL=$?
   [ $RETVAL -eq 0 ] && rm -f $lockfile
   $exec stop
   echo
}

#
#   See how we were called.
#
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  reload)
    stop
    start
    ;;
  force-reload|restart)
    stop
    sleep 1
    start
    RETVAL=$?
    ;;
  condrestart|try-restart)
    if [ -f $lockfile ]; then
        stop
        sleep 3
        start
    fi
    ;;
  status)
    status -p $pidfile $exec
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|reload|force-reload|status}"
    RETVAL=2
    [ "$1" = 'usage' ] && RETVAL=0
esac

exit $RETVAL


Copyright 2K16 - 2K18 Indonesian Hacker Rulez