#!/bin/bash
########################################################################
# MuGLIn - MuGLIn GNU/Linux Installation		                       #
#                                                                      #
# Copyright (C) 2010 Jakob Gurnhofer <jakob.gurnhofer@gmail.com>       #
# Copyricht (C) 2010 Srdjan Markovic <smark2ki@htl.moedling.at>        #
#                                                                      #
# This file is part of MuGLIn source code.                             #
#                                                                      #
# MuGLIn is free software: you can redistribute it and/or modify       #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# MuGLIn is distributed in the hope that it will be useful,            #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
# GNU General Public License for more details.                         #
#                                                                      #
# You should have received a copy of the GNU General Public License    #
# along with MuGLIn. If not, see <http://www.gnu.org/licenses/>.       #
########################################################################

# this code does not work
# i need more research about tftp-hpa, inetd etc to know how to manage this service -srdja
# --
# ok, to handle both types, inetd managed or not, we check both
# if one of them runs, it should be ok.
case $1 in
	start) /etc/init.d/tftpd-hpa start;;
	stop) /etc/init.d/tftpd-hpa stop;;
	restart) /etc/init.d/tftpd-hpa restart;;
	status)
		echo -n "TFTP: "
		if [  ! "`netstat -l -p -n | grep inetutils-inet | grep 69`" = "" ]; then
			echo "running"
			exit 1
		elif [ ! "`netstat -l -p -n | grep in.tftpd | grep 69`" = "" ]; then
			echo "running"
			exit 1
		else
			echo "not running";
			exit 0
		fi
	;;
esac
