Linux operating methods
In linux, the apache service is installed (by downloading binary files for economical compilation and installation, rather than rpm packages) and the apache service startup command is:/server/apache/bin/apachectl start. Run the apache service under runlevel 3. The command is as follows:
1)
The code is as follows: |
Copy code |
Touch/etc/rc. d/init. d/apache Vi/etc/rc. d/init. d/apache Chown-R root/etc/rc. d/init. d/apache Chmod 700/etc/rc. d/init. d/apache Ln-s/etc/rc. d/init. d/apache/etc/rc. d/rc3.d/S60apache |
# S is short for start, meaning start, K is short for kill, and stands for close. The number 60 indicates the order of startup. (For the iptv system, many services can be started normally only when the database is started. You can adjust the script startup sequence with this number ))
Apache content:
The code is as follows: |
Copy code |
#! /Bin/bash # Start httpd service /Server/apache/bin/apachectl start
|
Now the apache service can be automatically started at random under runtime level 3.
In windowsApache automatic restartCode
1. Create an autostartserver. bat file in the c: root directory, right-click it, set the file content to the following, and save it:
The code is as follows: |
Copy code |
@ ECHO OFF Net stop apache2 Net start apache2 Net stop mysql Net start mysql |
Note: The above apache2 and mysql are service names.
2. "start"-"run" cmd "-" run the command "at c:/autostartserver. bat"
In this way, the system automatically restarts apache and mysql at every morning.
Note: 04: 00 indicates the restart time, and c: autostartserver. bat indicates the bat file address in step 1.