differences between service command and running command directly

Daniel Carrillo daniel.carrillo at gmail.com
Tue Oct 4 15:41:36 UTC 2011


2011/10/4 Barry Brimer <lists at brimer.org>:
>> I use service and running the command in /etc/init.d/ directly  to run the
>> services in that directory. Until now I thought it was the same to run,
>> for
>> example:
>>
>> service httpd status
>>
>> and
>>
>> /etc/init.d/httpd status
>>
>> but now I have a server that they don´t do the same:
>
> <snip>
>
>> Anyone can explain me this? I suposse it´s something about enviroment
>> variables, but I can´t see the difference
>
> I would run both with bash -x and redirect the output and compare or diff
> them.
>
> bash -x service httpd status >/tmp/service.log 2>&1
>
> bash -x /etc/init.d/httpd status >/tmp/initscript.log 2>&1

IMHO: This has no sense, because service is only a wrapper who calls
to /etc/init.d/xservice

man service

service runs a System V init script in as predictable environment as
possible, removing most environment variables and with current working
directory set to /.

Best regrads.




More information about the redhat-list mailing list