Auto Shutdown and Restart Apache HTTPD Service Daemon at Preset Time Auto Shutdown và khởi động lại Apache httpd Service Daemon at Preset Thời gian

The core component of any websites, blogs, web services and web applications is the web server. Các thành phần cốt lõi của bất kỳ trang web, blog, dịch vụ web và các ứng dụng web là máy chủ web. And Apache is the most popular HTTP server that powers the websites worldwide. Apache và HTTP là phổ biến nhất của máy chủ mà quyền hạn của các trang web trên toàn thế giới. 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. Điều quan trọng để đảm bảo rằng thời gian hoạt động và liên tục chạy của Apache dịch vụ hoặc daemon trên server, vì nếu là dịch vụ httpd xuống, trang web của bạn sẽ được unaccessible cho du khách. 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. Khác hơn là sử dụng dịch vụ giám sát, tập lệnh hoặc tiện ích để kiểm tra xem daemon httpd là lên, máy chủ quản trị viên cũng có một sự lựa chọn để khởi động lại dịch vụ Apache theo định kỳ.

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. Tắt máy và khởi động lại Apache định kỳ tại khoảng cụ thể giúp đảm bảo rằng các dịch vụ web Apache luôn luôn trong tình trạng chạy đỉnh cao, không có hiệu lực của rò rỉ bộ nhớ có thể và nguồn lực hogging bởi các kết nối liên tục. 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. Nó cũng đảm bảo rằng thời gian ngừng các trang web được giới hạn trong việc tiếp theo lịch trình khởi động lại, chỉ trong trường hợp nó là như vậy không may mắn rằng Apache bị treo vô thời hạn và các dịch vụ giám sát của bạn không thể nhận các sự cố.

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. Để tắt máy và bắt đầu Apache tự động, chúng tôi có thể làm cho việc sử dụng crontab (hoặc theo lịch trình công tác hoặc Task Scheduler trong Windows Server) vào lịch trình làm nhiệm vụ tại thời điểm thích. Simply edit the cron jobs with a root or whell user, and add in the following line: Đơn giản chỉ cần sửa các công việc cron với một người chủ hoặc người sử dụng whell, và thêm vào dòng sau:

mhdmw /usr/local/apache/bin/apachectl restart mhdmw / usr / local / apache / bin / apachectl khởi động lại

Replace m, h, d, m and w with value of your preference, where they represent the following meaning: Thay thế m, h, d, m và w với giá trị của sở thích của bạn, nơi họ đại diện cho ý nghĩa sau đây:

m: min (0 – 59) m: min (0-59)
h: hour (0 – 23) h: hour (0-23)
d: day of month (1 – 31) d: ngày trong tháng (1-31)
m: month (1 – 12) m: tháng (1-12)
w: day of week (0 – 6) (Sunday=0) w: ngày trong tuần (0-6) (Chủ nhật = 0)

For variables that you want to happen every time, set it as * (asterisk). Đối với các biến mà bạn muốn để xảy ra mọi thời gian, thiết lập nó như là * (dấu sao).

For example, to kill the Apache daemon and start it immediately at 1 AM every night, set the crontab line to: Ví dụ, để giết daemon Apache và bắt đầu ngay lúc 01:00 mỗi đêm, thiết lập các đường dây crontab tới:

0 1 * * * /usr/local/apache/bin/apachectl restart 0 1 * * * / usr / local / apache / bin / apachectl khởi động lại

To restart Apache HTTPD service on weekend, such as Sunday 12 noon, use the following cron job: Để khởi động lại Apache httpd dịch vụ vào cuối tuần, như Chủ Nhật 12 giờ trưa, sử dụng các công việc cron sau đây:

0 12 * * 0 /usr/local/apache/bin/apachectl restart 0 12 * * 0 / usr / local / apache / bin / apachectl khởi động lại

You can input “man crontab” to learn more about cron jobs in Linux/Unix/FreeBSD/CentOS. Bạn có thể nhập vào "man crontab" để tìm hiểu thêm về công việc cron trong Linux / Unix / FreeBSD / CentOS. To edit the crontab job list, simply enter “crontab -e” on the shell. Để chỉnh sửa danh sách công việc crontab, chỉ cần nhập "crontab-e" trên vỏ. Existing crontab will appear on a text editor, such as GNU nano. Hiện có crontab sẽ xuất hiện trên một trình soạn thảo văn bản, chẳng hạn như GNU nano. 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. Nếu đây là trường hợp, thực hiện những thay đổi cần thiết, sau đó ấn phím "Ctrl-X", theo do "Y" để lưu tập tin, và làm theo bằng cách bấm phím Enter để chấp nhận các tên tập tin mặc định. The new crontab will be installed and in effect immediately. The crontab mới sẽ được cài đặt và có hiệu lực ngay lập tức.

Note that the path to apachectl may be different on different variant of Unix, Linux or BSD flavors. Lưu ý rằng đường dẫn đến apachectl có thể khác nhau về biến thể khác nhau của Unix, Linux hay BSD hương vị. Use one of the following command to find out where is Apache installed: Sử dụng một trong các lệnh sau để tìm nơi Apache được cài đặt:

find / apachectl | grep apachectl find / 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. Một số Apache có thể cài đặt trong / usr / sbin / apachectl, hoặc bạn có thể sử dụng httpd hoặc apachectl symbolic link trong / etc / rc.d / init.d / apachectl hoặc / etc / rc.d / init.d / httpd.

IMPORTANT : The page is machine translated and provided "as is" without warranty. Quan trọng: Sửa là máy dịch và cung cấp "như là" không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể khó hiểu. Please refer to Vui lòng tham khảo original English article bản gốc tiếng Anh bài viết whenever possible. bất cứ khi nào có thể.


Leave a Reply Để lại một trả lời

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> Bạn có thể sử dụng các thẻ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q <strike> <strong>

Subscribe to comments feature has been disabled. Thuê bao với ý kiến đều đã bị vô hiệu hoá. To receive notification of latest comments posted, subscribe to Để nhận được thông báo mới nhất đăng ý kiến, đăng ký với My Digital Life Comments RSS feed My Digital Life kiến RSS feed or hoặc register to receive đăng ký để nhận được new comments in daily email digest. Các ý kiến mới trong email tiêu hàng ngày.
Custom Search

New Articles Bài viết mới

Incoming Search Terms for the Article Tìm đến các Điều khoản Điều

shutdown apache tắt apache - -- apache shutdown apache tắt - -- restart apache service khởi động lại dịch vụ apache - -- centos apache restart centos apache khởi động lại - -- cron restart apache cron khởi động lại apache - -- shutdown apache linux tắt apache linux - -- apache daemon apache daemon - -- apache auto restart apache tự khởi động lại - -- centos autostart service centos tự khởi động dịch vụ - -- apache auto start apache tự động bắt đầu - -- cron job restart apache cron công việc khởi động lại apache - -- centos auto start httpd centos tự động bắt đầu httpd - -- apache restart interval apache khởi động lại khoảng - -- linux apache shutdown linux apache tắt - -- crontab restart service crontab khởi động lại dịch vụ - -- crontab service restart crontab dịch vụ khởi động lại - -- restart apache centos khởi động lại centos apache - -- restart httpd khởi động lại httpd - -- apache shutdown linux apache shutdown linux - -- crontab restart apache crontab khởi động lại apache - -- find apachectl tìm apachectl - -- freebsd restart apache freebsd khởi động lại apache - -- centos shutdown apache centos tắt apache - -- start apache httpd bắt đầu apache httpd - -- restart apache services khởi động lại dịch vụ apache - -- cron job to restart apache cron job để khởi động lại apache - -- cron httpd restart cron httpd khởi động lại - -- service apache restart dịch vụ khởi động lại apache - -- how to restart apache service làm thế nào để khởi động lại dịch vụ apache - -- linux restart apache service Linux khởi động lại dịch vụ apache - -- shutdown httpd tắt máy httpd - -- cron restart service cron khởi động lại dịch vụ - -- restart apache crontab khởi động lại crontab apache - -- centos reboot apache centos khởi động lại apache - -- how to shutdown apache làm thế nào để tắt apache - -- how to shutdown apache in linux làm thế nào để shutdown apache trong linux - -- apache daemon example apache daemon ví dụ - -- linux shutdown apache Linux tắt apache - -- cron apache restart cron apache khởi động lại - -- crontab apache restart crontab apache khởi động lại - -- how to shut down apache linux làm thế nào để tắt linux apache - -- centos autostart services centos tự khởi động dịch vụ - -- restart apache cron khởi động lại cron apache - -- restart apache via cron khởi động lại apache qua cron - -- restart httpd in freebsd khởi động lại httpd trong freebsd - -- apache restart service apache khởi động lại dịch vụ - -- freebsd apache autostart freebsd apache tự khởi động - -- centos autostart httpd centos autostart httpd - -- centos restart apache centos khởi động lại apache - -- httpd shutdown httpd tắt - --