Oden Eriksson <[EMAIL PROTECTED]> writes:
> On Fridayen den 14 December 2001 13.24, Sebastian Dransfeld wrote:
> > On Fri, 14 Dec 2001, Salane wrote:
> > > So it still doesnt work
> >
> > But 'service' is used to start standalone programs. To start
> > xinetd-programs you must activate them and restart xinetd.
>
> Exactly, this is not very obvious for the newbie. There should be something
> reloading (x)inetd when the affected services are activated/inactivated.
>
> Otherwise you will continue to see this kind of questions.
ok i checked that for service in cvs :
--- service.~1.8.~ Mon Dec 10 10:56:58 2001
+++ service Fri Dec 14 15:46:46 2001
@@ -11,9 +11,9 @@
opt=
fullrestart=
statusall=
-debug=
servicedir=/etc/init.d
+xinetddir=/etc/xinetd.d
version=$(echo '$Id: service,v 1.8 2001/12/10 09:56:58 chmouel Exp $'|cut -d" " -f3)
basename=${0##*/}
@@ -31,6 +31,29 @@
EOF
exit 1
}
+function check_if_inetd() {
+ local serv=$1
+ if [[ ! -f ${servicedir}/${serv} ]];then
+ if [[ -f ${xinetddir}/${serv} ]];then
+ if egrep -q ".*disable.*yes.*" ${xinetddir}/${serv};then
+ echo "$serv is a xinetd service and it is disabled"
+ echo "to activate it do the following command:"
+ echo -e "chkconfig ${serv} on"
+ service=
+ return
+ fi
+ service=xinetd
+ [[ $options = "start" ]] && options=reload
+ if [[ $options != reload ]] && [[ -z $fullrestart ]];then
+ echo "There is no such option for an xinetd services"
+ echo "You can only use the start option to reload a xinetd services"
+ service=
+ fi
+ echo "${serv} is a xinetd service"
+ fi
+ fi
+ return
+}
while [[ $1 = --* ]] || [[ $1 = -* ]];do
opt=$1
@@ -38,7 +61,7 @@
case $opt in
--full-restart|-f) fullrestart=yes;;
--status-all|-s) statusall=yes;;
- --debug|-d) debug="/bin/bash -x";;
+ --debug|-d) set -x ; debug="/bin/bash -x";;
--help|-h) usage;;
*) echo "Unknow option $opt"; usage;
esac
@@ -67,6 +90,7 @@
fi
if [[ -n $fullrestart ]];then
+ check_if_inetd "$service"
cd "$servicedir"
if [[ -f ./$service ]];then
$debug ./$service stop
@@ -81,10 +105,12 @@
[[ -z $options ]] && { echo "I need an action"; usage ;}
-if [ -x $servicedir/$service ]; then
+check_if_inetd "$service" ; [[ -z $service ]] && exit 1
+
+if [[ -x $servicedir/$service ]]; then
$debug $servicedir/$service $options
exit $?
else
- echo "Cannot find $servicedir/$service"
+ echo "Cannot find $service service"
usage
fi
--
http://www.linux-mandrake.com/en/club/