summaryrefslogtreecommitdiffstats
path: root/network/lizardfs/rc.lizardfs.new
blob: fa5b338c78f21af3a54ac23dafdd9058dffe399b (plain)
#!/bin/sh

# Init script file for LizardFS (or MooseFS) system.
# Written for Slackware Linux by Marcin Szychowski <szycha@gmail.com>
# This script starts enabled LizardFS services.
#
# LizardFS is a distributed, self-healing, self-replicating filesystem,
# available under GNU GPLv3 License for any FUSE-capable operating system.
# 
# Typical LizardFS installation consists of one master server, one or
# more meta-loggers and any number of chunk servers (the more the better).
# lizardfs Slackware Package contains software to run any of them.
#
# Although it is possible to run entire LizardFS system within one host
# you should not mix their roles across machines in a production
# environment.  Especially you should not run anything along with master
# server process on the same machine.
# For more details refer to lizardfs(7) manual page or LizardFS website
# http://lizardfs.org/
#
# Enable this script to start/stop/restart all enabled services in a convenient
# way rather than run services directly.  For your convenience,
# rc.lizardfs-chunkserver is enabled (executable) by default, since
# chunkservers are dominant group in average LizardFS installation.

services="master cgiserv metalogger chunkserver"

function everyone() {
  action="$1"

  if [ "$action" = "stop" ]; then
    local services="$(echo $services|tr ' ' "\n"|tac)"
  fi

  for svc in $services; do
    if [ -x /etc/rc.d/rc.lizardfs-$svc ]; then
      /etc/rc.d/rc.lizardfs-$svc $action
    fi
  done
}


case "$1" in
  'start')
    everyone start
    ;;
  'stop')
    everyone stop
    ;;
  'restart')
    everyone stop
    everyone start
    ;;
  'condrestart')
    everyone condrestart
    ;;
  'status')
    everyone status
    ;;
  'setup')
    /var/log/setup/setup.lizardfs-services
    ;;
  *)
    echo "Usage: $0 {setup|start|stop|restart|reload|condrestart|status}"
    ;;
esac