[Pm-utils] [PATCH] Add Pardus support into helper functios

S.Çağlar Onur caglar at pardus.org.tr
Sat Jan 13 06:29:49 PST 2007


Hi;

13 Oca 2007 Cts 12:28 tarihinde şunları yazmıştınız:
> i always believed "service" was a LSB thing, but could not find it in the
> 3.1 specification.
> On SUSE systems, "service foo {start|stop|restart|status}" just calls the
> init script, which has to support "status" anyway. I don't know about the
> Pardus init scripts, but wouldn't it be, in the long term, better for you
> if you just made your "service" behave like the "rest of the world"? :-)
> Means: a patch to "service" to take "status" as an alias for "info" would
> probably be as easy as patching this into pm-utils :-)
>
> I might be wrong here, of course, and i am not LSB-enlightened at all.

Nope you are right, i realize that after sending patch also :) although our 
init system is quite different ill add a status option to our service 
command.

> > +	if [ "$?" == "0" ]; then
> >  		echo "export ${1}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
> > -		"/etc/init.d/$1" stop 2>&1
> > +		if [ -x "/etc/init.d/$1" ]; then
> > +			"/etc/init.d/$1" stop 2>&1
> > +		elif [ -f /etc/pardus-release ]; then
> > +			service "$1" stop 2>&1
> > +		fi
>
> IMO we could unconditionally do 'service "$1" stop' here, at least on my
> system it would work.
>
> >  	fi
> >  }
> >
> >  restartservice()
> >  {
> > -	if [ "x$(eval echo \$${1}_SERVICE_ACTIVATE)" == "xyes" \
> > -			-a -x "/etc/init.d/$1" ]; then
> > -		"/etc/init.d/$1" start 2>&1
> > +	if [ "x$(eval echo \$${1}_SERVICE_ACTIVATE)" == "xyes" ]; then
> > +		if [ -x "/etc/init.d/$1" ]; then
> > +			"/etc/init.d/$1" start 2>&1
> > +		elif [ -f /etc/pardus-release ]; then
> > +			service "$1" start 2>&1
> > +		fi
>
> same here, we should just do 'service "$1" start' here unconditionally.
> IMVHO we should only start to do this distribution specific stuff if it
> is absolutely unavoidable.

Thanks for your comments, what about using only service command like 
following?

...
service "$1" status 2>/dev/null | grep -c -q running

if [ "$?" == "0" ]; then
    echo "export ${1}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
    service "$1" stop 2>&1
fi
...

cause we don't have any init scripts on somewhere in filesystem 
(/etc/init.d/$1 check always fails for us), we have a daemon called comar 
which is our configuration manager and our pyhtonic init scripts lays on its 
database :)

Cheers
-- 
S.Çağlar Onur <caglar at pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/pm-utils/attachments/20070113/b09a6a08/attachment.pgp


More information about the Pm-utils mailing list