File openstack-swift-functions of Package openstack-swift
# vim: filetype=sh
. /etc/rc.d/init.d/functions
swift_action() {
retval=0
name="$1"
component=$(echo $1 | cut -f 1 -d -)
call="swift_$2"
if [[ -f "/etc/swift/$component-server.conf" ]]; then
$call "$name" \
"/etc/swift/$component-server.conf" \
"/var/run/swift/$name.pid"
[ $? -ne 0 ] && retval=1
else
# Unconfigured service
# http://fedoraproject.org/wiki/Packaging/SysVInitScript#Exit_Codes_for_non-Status_Actions
retval=6
fi
return $retval
}
swift_start() {
name="$1"
conf_file="$2"
pid_file="$3"
ulimit -n ${SWIFT_MAX_FILES-32768}
echo -n "Starting swift-$name: "
daemon --pidfile $pid_file \
"/usr/bin/swift-$name $conf_file &>/dev/null & echo \$! > $pid_file"
retval=$?
echo
return $retval
}
swift_stop() {
name="$1"
conf_name="$2"
pid_file="$3"
echo -n "Stopping swift-$name: "
killproc -p $pid_file -d ${SWIFT_STOP_DELAY-15} $name
retval=$?
echo
return $retval
}
swift_status() {
name="$1"
conf_name="$2"
pid_file="$3"
status -p $pid_file $name
}