The difference between /etc/init.d/progname start and progname start

David david at kenpro.com.au
Thu Feb 17 23:54:34 UTC 2005


On Thu, Feb 17, 2005 at 12:44:34PM -0800, Behrang Saeedzadeh wrote:
> On Thu, 17 Feb 2005 08:14:24 -0500, Kirtis Bakalarczyk
> <kirtis.bakalarczyk at gmail.com> wrote:

> Is it possible that both of them do the same thing? For example, I can
> run samba by both writing:
> 
>     sudo? samba start
> 
> and
> 
>    sudo? /etc/init.d/samba start
> 
> Are they doing the same thing?
> 
> BTW - A friend of mine told me that I can write
> 
>    service {whatever} start|stop|restart
> 
> in Fedora that is a short form of the 
> 
>    /etc/init.d/{whatever} start|stop|restart
> 
> Do I need to do something special in Ubuntu inorder to be able to use
> the "service" command?


Your friend has misled you  :)

#/etc/init.d/postfix start

doesn't actually invoke the program called postfix. It invokes a shell 
script which is also called postfix, which in turn starts the mail daemon 
- otherwise known as a service. 

The shell script is told to "start" the daemon. It can also be told to 
"stop" the service - eg:

#/etc/init.d/postfix stop

Sometimes these shell scripts have the same name as the service, and 
sometimes not. For instance /etc/init.d/bind9 starts the named daemon, but 
/etc/init.d/apache2 starts the apache2 daemon. It's slightly confusing 
sometimes.

If you did:
#apache2 start
I'm not sure what would happen, but possibly not much, and almost 
certainly not what you intend.




More information about the ubuntu-users mailing list