A fake CTDB stub that prints items depending on the variables
FAKE_CTDB_PNN (default 0) depending on command-line options.
-
-Note that -Y is ignored.
-
EOF
+ exit 1
+}
+
+not_implemented ()
+{
+ echo "${prog}: command \"$1\" not implemented in stub" >&2
exit $not_implemented_exit_code
}
eval set -- "$_temp"
verbose=false
+machine_readable=false
while true ; do
case "$1" in
- -Y) shift ;;
+ -Y) machine_readable=true ; shift ;;
-v) verbose=true ; shift ;;
--) shift ; break ;;
-h|--help|*) usage ;; # * shouldn't happen, so this is reasonable.
# For testing backward compatibility...
for i in $CTDB_NOT_IMPLEMENTED ; do
if [ "$i" = "$1" ] ; then
- echo "${prog}: command \"$i\" not implemented" >&2
- usage
+ not_implemented "$i"
fi
done
exit 0
;;
+ scriptstatus)
+ $machine_readable || not_implemented "$1, without -Y"
+ [ "$2" != "all" ] || not_implemented "scriptstatus all"
+ # For now just assume everything is good.
+ _d1=$(date '+%s.%N')
+ _d2=$(date '+%s.%N')
+ echo ":Type:Name:Code:Status:Start:End:Error Output...:"
+ for _i in "$CTDB_BASE/events.d/"*.* ; do
+ _b="${_i##*/}" # basename
+ _status="OK"
+ _code="0"
+ if [ ! -x "$_i" ] ; then
+ _status="DISABLED"
+ _code="-8"
+ fi
+ echo ":${2:-monitor}:${_b}:${_code}:${_status}:${_d1}:${_d2}::"
+ done
+ ;;
*)
- echo "${prog}: command \"$1\" not implemented in stub"
- usage
+ not_implemented "$1"
esac
-