Mogile Startup scripts?

Arthur Bebak abebak at fabrikinc.com
Mon Aug 20 18:41:41 UTC 2007


Brandon Ooi wrote:
> try
> 
>  > su -u mogile mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon
> 
> b
> 
> drpr0ctologist at gmail.com wrote:
>> I've been able to get MogileFS up and running. Now I need to put these 
>> services into system startup scripts so that they run when the system 
>> is started.  Are there such startup scripts or do I just put them in 
>> /etc/rc.d/rc.local?
>>  
>> The only item I'm having trouble with is the tracker.  Right now I 
>> start it by doing a "su mogile", then running "mogilefsd -c 
>> /etc/mogilefs/mogilefsd.conf --daemon".  How would I put that into the 
>> /etc/rc.d/rc.local?
> 

Here are a couple of startup scripts for RedHat, first for a tracker
mogilefsd, second for mogstored.
-------------------- snip -----------------------
#!/bin/bash
#
# mogilefsd    Startup script for the MogileFS tracker
#
# chkconfig: - 85 15
# description: MogileFS tracker
# processname: mogilefsd
# config: /etc/mogilefs/mogilefsd.conf
# pidfile: /var/run/mogilefsd.pid

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

# Path to the apachectl script, server binary, and short-form for messages.
lockfile=${LOCKFILE-/var/lock/mogilefsd}
RETVAL=0

start() {
         echo -n $"Starting mogilefsd: "
         sudo -u mogile /usr/bin/mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && touch ${lockfile}
         return $RETVAL
}
stop() {
         echo -n $"Stopping $prog: "
         killproc mogilefsd
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && rm -f ${lockfile}
}
reload() {
     echo -n $"Reloading mogilefsd: "
     killproc mogilefsd -HUP
     RETVAL=$?
     echo
}

# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   status)
         status mogilefsd
         RETVAL=$?
         ;;
   restart)
         stop
         start
         ;;
   reload)
         reload
         ;;
   *)
         echo $"Usage: mogilefsd {start|stop|restart|reload|status}"
         exit 1
esac

exit $RETVAL

------------------ snip ------------------

------------------ snip ------------------

#!/bin/bash
#
# mogstored  - Startup script for the MogileFS storage node
#
# chkconfig: - 85 15
# description: MogileFS storage node
# processname: mogstored
# config: /etc/mogilefs/mogstored.conf
# pidfile: /var/run/mogstored.pid

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

# Path to the apachectl script, server binary, and short-form for messages.
lockfile=${LOCKFILE-/var/lock/mogstored}
RETVAL=0

start() {
         echo -n $"Starting mogstored: "
         /usr/bin/mogstored --config /etc/mogilefs/mogstored.conf --daemonize > /dev/null
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && touch ${lockfile}
         return $RETVAL
}
stop() {
         echo -n $"Stopping $prog: "
         killproc mogstored
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && rm -f ${lockfile}
}
reload() {
     echo -n $"Reloading mogstored: "
     killproc mogstored -HUP
     RETVAL=$?
     echo
}

# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   status)
         status mogstored
         RETVAL=$?
         ;;
   restart)
         stop
         start
         ;;
   reload)
         reload
         ;;
   *)
         echo $"Usage: mogstored {start|stop|restart|reload|status}"
         exit 1
esac

exit $RETVAL

------------------------------ snip ------------------------

-- 
Arthur Bebak
abebak at fabrikinc.com


More information about the mogilefs mailing list