#!/bin/ksh

TMPDIR="${TMPDIR:-/tmp}"

function create_chef_txt {
        touch $TMPDIR/chefinittest.txt
}

function delete_chef_txt {
        rm $TMPDIR/chefinittest.txt
}

function rename_chef_txt {
        mv $TMPDIR/chefinittest.txt $TMPDIR/$1
}

case "$1" in
start )
        create_chef_txt
        ;;
stop )
        delete_chef_txt
        ;;
status )
        [ -f $TMPDIR/chefinittest.txt ] || [ -f $TMPDIR/chefinittest_reload.txt ] || [ -f $TMPDIR/chefinittest_restart.txt ]
        ;;
reload )
        rename_chef_txt "chefinittest_reload.txt"
        ;;
restart )
        rename_chef_txt "chefinittest_restart.txt"
        ;;
* )
        echo "Usage: $0 (start | stop | restart | reload)"
        exit 1
esac
