Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use the service command in linux? [closed]

Tags:

linux

service

What is the difference between

service apache2 restart

and

/etc/init.d/apache2 restart

So basically why is the service command recommended compared to directly invoking the appropriate command?

like image 643
bluesman Avatar asked Oct 11 '13 07:10

bluesman


1 Answers

The service command runs the init scripts in a predictable environment:

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

from: http://linux.die.net/man/8/service

like image 114
jonas Avatar answered Nov 10 '22 16:11

jonas