#!/bin/bash

# postfcsd
#
# $Id: postfcsd 1757 2013-03-15 18:00:33Z jhealy $
#
# This is a FirstClass hook script.  It must reside in a folder that
# the FC init scripts (/etc/init.d/fc[i]sd) are configured to look for
# (/home/fcadmin/Documents by default, but Suffield Academy overrides this
# in the scripts to /opt/fcsd/suffield_prepost).
#
# This is a hook script that ties into commands issued by the
# FC Core Services controller, located at /usr/sbin/fcsctl.
# Please see that file for an idea of the types of commands that
# can be processed.
#
# Commands run in this script are run just AFTER fcsctl starts
# the Core Services daemon on the machine.  Any arguments provided to
# fcsctl are passed directly to this script as well, one argument
# per invocation.  For example:
#
# /usr/sbin/fcsctl start status
#
# Would cause fcsctl to process the "start" argument, then call this
# scrip with an arg of "start", then process "status" itself, and finally
# call this script with an arg of "status".
#
# Finally, this script has access to any variable defined in the calling
# script.  Examples include:
#
#    SERVICE_NAME
#    SERVICE_APP
#    SERVICE_FOLDER
#    SERVICE_PID
#    USERDOCS
#

ARG="${1}"

echo "postfcsd: Executing postflight script with arg '${ARG}':"

case $ARG in
    start)
        # parent confirms that PID exists for service before calling preflight
	echo "postfcsd: No postflight operations for action '${ARG}'; skipping"
	;;
    stop)
        # parent confirms that PID has terminated before calling postflight
	echo "postfcsd: No postflight operations for action '${ARG}'; skipping"
	;;
    *)
	echo "postfcsd: Unknown argument '${ARG}'; skipping"
	;;
    
esac

