Auto Shutdown and Restart Apache HTTPD Service Daemon at Preset Time自动关机和重新启动了Apache的httpd服务守护进程在预设时间

The core component of any websites, blogs, web services and web applications is the web server.的核心组成部分,任何网站,博客,网络服务和网络应用是Web服务器。 And Apache is the most popular HTTP server that powers the websites worldwide.和Apache是最流行的HTTP服务器,权力全世界的网站。 It’s important to ensure that the uptime and continuous running of Apache service or daemon on the server, as if HTTPD service is down, your website will be unaccessible to the visitors.重要的是要确保正常运行和持续运行的Apache服务或守护进程的服务器上,仿佛的httpd服务下来,您的网站将无法使用参观者。 Other than using monitoring service, script or utility to check if the HTTPD daemon is up, server administrator also has a choice to restart the Apache service periodically.除了使用监控服务,脚本或实用工具来检查,如果的httpd守护进程是,服务器管理员也可以选择重新启动Apache的定期服务。

Shutdown and restart Apache periodically at specific interval helps to ensure that Apache web service is always running in top notch condition, without effect of possible memory leak and resource hogging by persistent connections.关机和重新启动了Apache定期在特定时间间隔有助于确保Apache网络服务始终运行在顶尖状态,而不影响可能内存泄漏和资源占用的持久连接。 It also ensure that the web sites downtime is limited to the next restart schedule, just in case it’s so unlucky that Apache hangs indefinitely and your monitoring service can’t pick up the incident.它还确保网站宕机时间限定为在下次重新启动的时间表,以防万一这么倒霉的阿帕奇挂起无限期地和你的监测服务无法收拾事件。

To shutdown and start Apache automatically, we can make use of crontab (or Scheduled Task or Task Scheduler in Windows Server) to schedule the task at the time prefer.要关闭和启动Apache自动,我们可以使用crontab (或排定的工作或任务计划程序在Windows Server ) ,以计划任务的时候喜欢。 Simply edit the cron jobs with a root or whell user, and add in the following line:只需编辑职位玉米根或whell用户,并加上下面一行:

mhdmw /usr/local/apache/bin/apachectl restart mhdmw的/ usr / local /阿帕奇/斌/ apachectl重新启动

Replace m, h, d, m and w with value of your preference, where they represent the following meaning:替换米,小时,天,米和w的价值,您的喜好,他们代表下列含义:

m: min (0 - 59)男:民( 0 -5 9)
h: hour (0 - 23)小时:小时( 0 -2 3)
d: day of month (1 - 31) D组:每月一天( 1 -3 1)
m: month (1 - 12)男:一个月( 1 -1 2)
w: day of week (0 - 6) (Sunday=0)瓦特:一周内每天的( 0 -6 ) (星期日= 0 )

For variables that you want to happen every time, set it as * (asterisk).对于变量,你想每一次发生,设置为* (星号) 。

For example, to kill the Apache daemon and start it immediately at 1 AM every night, set the crontab line to:例如,如果要杀死的Apache守护进程,并立即开始于凌晨1时每天晚上,设置crontab线:

0 1 * * * /usr/local/apache/bin/apachectl restart 0 1 * * *的/ usr / local /阿帕奇/斌/ apachectl重新启动

To restart Apache HTTPD service on weekend, such as Sunday 12 noon, use the following cron job:为了重新启动了Apache的httpd服务上周末,如星期日中午12时,请使用下列作业:

0 12 * * 0 /usr/local/apache/bin/apachectl restart 0 12 * * 0的/ usr / local /阿帕奇/斌/ apachectl重新启动

You can input “man crontab” to learn more about cron jobs in Linux/Unix/FreeBSD/CentOS.您可以输入“人crontab ” ,以了解更多关于就业玉米在Linux / UNIX / FreeBSD的/ CentOS 。 To edit the crontab job list, simply enter “crontab -e” on the shell.编辑crontab的工作清单中,只需输入“ crontab娥”的空壳。 Existing crontab will appear on a text editor, such as GNU nano.现有的crontab会出现在文字编辑器,如纳米的GNU 。 If this is the case, make the necessary changes, then press “Ctrl-X”, follow by “Y” to save the file, and follow by Enter press to accept the default file name.如果是这种情况,作必要的修改,然后按“按Ctrl - X ”的,后续的“ Y ”型,以保存该文件,并按照记者的输入,以接受默认的文件名。 The new crontab will be installed and in effect immediately.新的crontab将被安装并立即生效。

Note that the path to apachectl may be different on different variant of Unix, Linux or BSD flavors.请注意,路径apachectl可能会有所不同不同的变异的Unix , Linux或BSD的味道。 Use one of the following command to find out where is Apache installed:使用下列其中一个命令,以找出是Apache的安装:

find / apachectl | grep apachectl找到/ apachectl | grep apachectl
whereis apachectl whereis apachectl

Some Apache may install in /usr/sbin/apachectl, or you can use the httpd or apachectl symbolic links in /etc/rc.d/init.d/apachectl or /etc/rc.d/init.d/httpd.一些阿帕奇可安装在/ usr / sbin / apachectl ,或您可以使用的httpd或apachectl符号链接在/ etc / rc.d / init.d / apachectl或/ etc / rc.d / init.d /的httpd 。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明:这是一台机器翻译网页这是“原样”提供,无保修。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原文的文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at共享和贡献或获得技术支持和帮助 My Digital Life Forums 我的数字生活论坛 .



Leave a Reply留下一个回复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用这些标签: href="" title="">的<a <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> “删除日期时间= “ ” “的<em> <i> <q cite=""> <strike>的<strong>

Subscribe without commenting订阅没有评论


Custom Search

New Articles新文章

Incoming Search Terms for the Article收到的搜索字词的文章

crontab restart apache crontab重新启动Apache - - cron httpd restart 玉米的httpd启动 - - centos restart apache centos重新启动Apache - - shutdown httpd 关机的httpd - - restart apache service 重新启动Apache服务 - - apache daemon 阿帕奇守护 - - restart httpd 重新启动的httpd - - restart apache httpd 重新启动Apache的httpd - - restart httpd freebsd 重新启动的httpd的FreeBSD - - how to reset apache services automatically in windows 如何重置阿帕奇服务会自动在Windows - - apachectl centos apachectl centos - - restart apache centos 重新启动Apache centos - - shut down apache linux 关闭阿帕奇Linux操作系统 - - apache shutdown 阿帕奇关机 - - autostart apache centos 自动阿帕奇centos - - apache service restart 阿帕奇服务启动 - - centos restart centos重新启动 - - auto restart apache 自动重新启动Apache - - рестарт apache рестарт阿帕奇 - - apachectl restarting from crontab script for HP 从apachectl重新启动crontab脚本惠普 - - auto restart daemon 自动重新启动守护进程 - - autostart daemon linux Linux系统自动启动守护进程 - - CentOS apache auto start CentOS的Apache自动启动 - - centos script apache restart no such file centos脚本阿帕奇重新启动没有这样的文件 - - centos automatically start service\ centos自动启动服务\ - - cron job to restart apache 作业重新启动Apache - - cron autostart 玉米自动 - - freebsd +Apache +"auto start" 阿帕奇的FreeBSD + + “自动启动” - - man crontab @reboot 男子crontab @重新启动 - - restart service auto 自动重新启动服务 - - restarting services with cron 重新启动服务,冠群 - - restart apache in centos 重新启动Apache在centos - - scheduled restart apache 定于重新启动Apache - - unix command to check httpd service Unix的命令检查的httpd服务 - - WHM centos apache down restart 阿帕奇的WHM centos下跌重新启动 - - apache restart periodically 阿帕奇定期重新启动 - - apachectl file centos apachectl档案centos - - apache service on CentOS 阿帕奇服务CentOS - - centos restart shutdown centos关机重新启动 - - crontab autostart crontab自动 - - cron job to stop and restart a linux service 计划作业停止并重新启动一个Linux服务 - - httpd cron 玉米的httpd - - linux restart apache service Linux系统重新启动Apache服务 - - restart apache at restart 重新启动Apache在重新启动 - - start daemon without restart PC 没有启动守护进程重新启动电脑 - - what is httpd service 是什么的httpd服务 - - apache crontab 阿帕奇crontab - - automatic start httpd + Centos 自动启动的httpd + Centos - - auto restart httpd on hang linux 自动重新启动的httpd Linux操作系统上挂起 - - cannot find "httpd service" 无法找到“的httpd服务” - -