LinHES Forums http://forums.linhes.org/ |
|
Start \ Stop webserver from command line http://forums.linhes.org/viewtopic.php?f=17&t=18515 |
Page 1 of 1 |
Author: | gatorback [ Fri Jul 11, 2008 6:25 pm ] |
Post subject: | Start \ Stop webserver from command line |
I am pointing my web browser to my KM machine and it does not return a web page. I would like to be able to perform the following tasks from SSH: 1) query the webserver's status (running \ stopped) 2) start \ stop the webserver I am assuming that the problem is with the webserver (it was working yesterday). In addition I am also assuming that if I can ping 'mythtvhost' from a dosprompt, IE7 (DNS) is able to resolve the IP address. Any suggestions to address the tasks above or diagnose the issue are appreciated. Thank you. |
Author: | ceenvee703 [ Fri Jul 11, 2008 6:33 pm ] |
Post subject: | |
1) use the command Code: ps -ef | grep apache2 2) as root Code: /etc/init.d/apache2 stop
/etc/init.d/apache2 start (or just "/etc/init.d/apache2 restart" to do the same thing as a stop/start) |
Author: | gatorback [ Fri Jul 11, 2008 7:17 pm ] |
Post subject: | |
I tried rebooting the mythtvhost server and noticed that during the boot sequence that there was something wrong with the apache service. If memory serves, there was a message similar to this: Quote: Remove it before continuing if it is corrupted.
I tried the commands (thank you) from ceenvee703: Code: root@mythtvhost:~# ps -ef | grep apache2 root 3421 3318 0 21:09 ttyp0 00:00:00 grep apache2 root@mythtvhost:~# /etc/init.d/apache2 stop Stopping web server (apache2)...(20014)Internal error: Error retrieving pid file /var/run/apache2.pid Remove it before continuing if it is corrupted. failed! root@mythtvhost:~# /etc/init.d/apache2 start Starting web server (apache2)...(20014)Internal error: Error retrieving pid file /var/run/apache2.pid Remove it before continuing if it is corrupted. failed! root@mythtvhost:~# ps -ef | grep apache2 root 3480 3318 0 21:10 ttyp0 00:00:00 grep apache2 root@mythtvhost:~# kill 3318 root@mythtvhost:~# ps -ef | grep apache2 root 3482 3318 0 21:10 ttyp0 00:00:00 grep apache2 Not sure that I used the kill command correctly. Am I on the right track to restoring webserver functionality or are there additional diagnostic tests needed before determining a course of action? Thank you! I have used RH's service command like this: Code: [root@flamingo init.d]# ls ht*
httpd.vmware [root@flamingo init.d]# service httpd.vmware status httpd (pid 4110 4106 4098 4094) is running... [root@flamingo init.d]# |
Author: | tjc [ Fri Jul 11, 2008 7:33 pm ] |
Post subject: | |
So do like the messages tell you and remove the pid file. 0) Become root - http://www.knoppmythwiki.org/index.php?page=BecomeRoot 1) First make sure that the server is not running: Code: pkill -9 -fl apache 2) Then remove the file: Code: rm -f /var/run/apache2.pid 3) Then restart the server: Code: /etc/init.d/apache2 start
|
Author: | gatorback [ Fri Jul 11, 2008 9:13 pm ] |
Post subject: | |
Thanks for the suggestions tjc. Much appreciated. I tried them and found this: Quote: root@mythtvhost:/etc/init.d# apache2 start
Usage: apache2 [-D name] [-d directory] [-f file] [-C "directive"] [-c "directive"] [-k start|restart|graceful|graceful-stop|stop] [-v] [-V] [-h] [-l] [-L] [-t] [-S] Options: -D name : define a name for use in <IfDefine name> directives -d directory : specify an alternate initial ServerRoot -f file : specify an alternate ServerConfigFile -C "directive" : process directive before reading config files -c "directive" : process directive after reading config files -e level : show startup errors of level (see LogLevel) -E file : log startup errors to file -v : show version number -V : show compile settings -h : list available command line options (this page) -l : list compiled in modules -L : list available configuration directives -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings) -S : a synonym for -t -D DUMP_VHOSTS -t -D DUMP_MODULES : show all loaded modules -M : a synonym for -t -D DUMP_MODULES -t : run syntax check for config files I ended up using this: Code: root@mythtvhost:/etc/init.d# apache2 -k start Note: had to remove the -l option when issuing the pkill command. Apparently it only works with pgrep. root@mythtvhost: Code: /etc/init.d# pkill -9 -f apache2 root@mythtvhost:/etc/init.d# Code: ps -ef | grep apache2 root 4794 4764 0 23:09 ttyp4 00:00:00 grep apache2 root@mythtvhost:/etc/init.d# ps -ef | grep apache2 root 4806 4764 0 23:09 ttyp4 00:00:00 grep apache2 root@mythtvhost: Code: /etc/init.d# /etc/init.d/apache2 start
Starting web server (apache2).... root@mythtvhost:/etc/init.d# ps -ef | grep apache2 root 4811 1 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start www-data 4812 4811 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start www-data 4813 4811 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start www-data 4814 4811 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start www-data 4815 4811 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start www-data 4816 4811 0 23:09 ? 00:00:00 /usr/sbin/apache2 -k start root 4822 4764 0 23:09 ttyp4 00:00:00 grep apache2 |
Author: | tjc [ Sat Jul 12, 2008 12:19 am ] |
Post subject: | |
gatorback wrote: Thanks for the suggestions tjc. Much appreciated. I tried them and found this: Code: root@mythtvhost:/etc/init.d# apache2 start Sigh... Code: root@black2:~# type -p apache2
/usr/sbin/apache2 This is not the same. If somebody tells you to run an init script you'll notice that they _always_ tell you to use the full path, e.g. "/etc/init.d/something" - As root '.' is not and should never be in your path for safety reasons. - The /etc/init.d directory is also not in your path for very good although more subtle reasons. (Init scripts very often have the same name as the daemon process they start.) - When you're given a full path for something there is usually a reason... |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |