linux - What's the difference? sudo restart -
what's difference between:
sudo /etc/init.d/apache2 restart and
sudo service apache2 restart i tried first one, , didn't apply changes, while
sudo service apache2 restart did uptake changes.
here happening when run sudo /etc/init.d/apache2 restart:
if ! $apache2ctl configtest > /dev/null 2>&1; $apache2ctl configtest || true log_end_msg 1 exit 1 fi if check_htcacheclean ; log_daemon_msg "restarting web server" "htcacheclean" stop_htcacheclean log_progress_msg apache2 else log_daemon_msg "restarting web server" "apache2" fi pid=$(pidof_apache) || true if ! apache_wait_stop; log_end_msg 1 || true fi if $apache2ctl start; if check_htcacheclean ; start_htcacheclean || log_end_msg 1 fi log_end_msg 0 else log_end_msg 1 fi as can see; first config test run, if successful server stopped , started.
i find hard believe running command did not apply changes if saved , valid. utilize command , have never had issue.
/usr/bin/service described as:
# convenient wrapper /etc/init.d init scripts. and following:
servicedir="/etc/init.d" # otherwise, utilize traditional sysvinit if [ -x "${servicedir}/${service}" ]; exec env -i lang="$lang" path="$path" term="$term" "$servicedir/$service" ${action} ${options} else echo "${service}: unrecognized service" >&2 exit 1 fi so commands identical, sudo service apache2 restart wrapper sudo /etc/init.d/apache2 restart.
you may utilize sudo /etc/init.d/apache2 reload, reloads config without restarting server. works if have changed config, not load modules have enabled, need restart apache.
edit: code debian system.
linux apache
No comments:
Post a Comment