Files
s390-tools/etc/init.d/cpacfstatsd
Michael Holzheu b627b8d8e1 Initial s390-tools-2.0.0 import
This commit is based on the s390-tools-1.39.0 version.

Changes on top of s390-tools-1.39.0:

 - Add MIT license to all source files
 - Add LICENSE file
 - Transform REAMDE to README.md (markdown)
 - Add AUTHORS.md file
 - Add CONTRIBUTING.md file
 - Move changelog from README to CHANGELOG.md file

Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
2017-08-21 10:55:40 +02:00

90 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
### BEGIN INIT INFO
# Provides: cpacfstatsd
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start the cpacfstatsd daemon for Linux on System z
# Description: CPACF statistics collection daemon process for Linux on System z
### END INIT INFO
DAEMON=cpacfstatsd
DAEMON_PATH=/usr/sbin/cpacfstatsd
RUN_PID_FILE=/var/run/cpacfstatsd.pid
RETVAL=0
OPTIONS=""
# source function library
. /lib/lsb/init-functions
start()
{
if [ ! -f $RUN_PID_FILE ]; then
echo -n $"Starting $DAEMON:"
$DAEMON_PATH $OPTIONS
if [ $? == "0" ]; then
log_success_msg
else
log_failure_msg
fi
echo
else
echo "$DAEMON (pid $(cat $RUN_PID_FILE)) is already running..."
echo
fi
}
stop()
{
echo -n $"Stopping $DAEMON:"
if [ -f $RUN_PID_FILE ]; then
killproc $DAEMON_PATH -TERM
log_success_msg
rm -f $RUN_PID_FILE
else
log_failure_msg
fi
echo
}
restart() {
stop
sleep 1
start
}
status()
{
if [ ! -f $RUN_PID_FILE ]; then
echo "$DAEMON is not running."
echo
else
echo "$DAEMON (pid $(cat $RUN_PID_FILE)) is running."
echo
fi
}
# How are we called?
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage: $DAEMON {start|stop|status|restart}"
RETVAL=1
esac
exit $RETVAL