Auto Shutdown and Restart Apache HTTPD Service Daemon at Preset Time Auto Shutdown un restart Apache httpd Service Daemon pie Preset Time
The core component of any websites, blogs, web services and web applications is the web server. Galvenā sastāvdaļa katrā mājas lapas, blogi, Web Services un Web lietojumprogrammas ir web serveri. And Apache is the most popular HTTP server that powers the websites worldwide. Un Apache ir populārākais HTTP serveris, pilnvaras mājas lapām visā pasaulē. 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. Tas ir svarīgi nodrošināt, uptime un nepārtrauktu darbību Apache pakalpojumu vai dēmonu uz servera, kā httpd pakalpojums ir samazinājies, jūsu mājas lapa tiks unaccessible ar apmeklētājiem. 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. Kurās neizmanto monitoringu, skriptu vai lietderība, lai pārbaudītu vai httpd daemon ir izveidota, servera administrators ir arī izvēle atsākt Apache dienests periodiski.
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. Shutdown un restart Apache periodiski pēc īpaša intervāla palīdz nodrošināt to, ka Apache web pakalpojums vienmēr darbojas top notch stāvoklī, bez ievērības iespējamie atmiņas noplūde un resursu hogging pastāvīga savienojumus. 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. Tas arī nodrošinās, ka tīmekļa vietnēs dīkstāves ir ierobežots līdz nākamā restart grafika, tikai gadījumā, ja tas ir tik nelaimīgs, ka Apache karājas mūžīgi, un jūsu monitoringu nevar uzņemt incidentu.
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. Jāaizver un sākt Apache automātiski, mēs varam izmantot crontab (vai ieplānotais uzdevumu vai uzdevumu plānotāju Windows Server) grafika uzdevums laikā dod priekšroku. Simply edit the cron jobs with a root or whell user, and add in the following line: Vienkārši rediģēt cron darba vietas ar saknēm vai whell lietotājam, un pievienot šādu rindu:
mhdmw /usr/local/apache/bin/apachectl restart mhdmw / usr / local / apache / bin / apachectl restart
Replace m, h, d, m and w with value of your preference, where they represent the following meaning: Aizstāt m, h, d, m un w ar vērtību jūsu preferences, ja tās ir šāda nozīme:
m: min (0 – 59) m: min (0 - 59)
h: hour (0 – 23) h: stunda (0 - 23)
d: day of month (1 – 31) d: diena (1 - 31 mēnesis)
m: month (1 – 12) m: mēnesis (1 - 12)
w: day of week (0 – 6) (Sunday=0) w: diena (0 - 6) nedēļā (svētdiena = 0)
For variables that you want to happen every time, set it as * (asterisk). Mainīgajiem, ka jūs vēlaties, lai notiktu ik laiku, iestatiet to kā * (zvaigznīte).
For example, to kill the Apache daemon and start it immediately at 1 AM every night, set the crontab line to: Piemēram, lai nogalinātu Apache dēmonu un sākt to nekavējoties pēc 1 katru nakti, kas crontab līnija:
0 1 * * * /usr/local/apache/bin/apachectl restart 0 1 * * * / usr / local / apache / bin / apachectl restart
To restart Apache HTTPD service on weekend, such as Sunday 12 noon, use the following cron job: Atsākt Apache httpd pakalpojumu nedēļas nogalē, piemēram, svētdiena 12 pusdienlaiks, izmantojiet šādas Cron job:
0 12 * * 0 /usr/local/apache/bin/apachectl restart 0 12 * * 0 / usr / local / apache / bin / apachectl restart
You can input “man crontab” to learn more about cron jobs in Linux/Unix/FreeBSD/CentOS. Jūs varat ievadīt "man crontab", lai uzzinātu vairāk par cron darbavietu Linux / Unix / FreeBSD / CentOS. To edit the crontab job list, simply enter “crontab -e” on the shell. Lai rediģētu crontab darba vietu sarakstu, vienkārši ievadiet "crontab-e" uz korpusa. Existing crontab will appear on a text editor, such as GNU nano. Esošās crontab parādīsies teksta redaktoru, piemēram, 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. Ja tas tā ir gadījumā, veikt nepieciešamās izmaiņas, nospiediet taustiņu "Ctrl-X", seko ar "Y", lai saglabātu failu, un sekot līdz Enter preses akceptēt noklusējuma faila nosaukumu. The new crontab will be installed and in effect immediately. Jauns crontab tiks uzstādīts un spēkā nekavējoties.
Note that the path to apachectl may be different on different variant of Unix, Linux or BSD flavors. Ņemiet vērā, ka ceļš uz apachectl var būt atšķirīgi dažādu variantu, Unix, Linux vai BSD flavors. Use one of the following command to find out where is Apache installed: Par šādu komandu Izmantojiet vienu, lai uzzinātu, kur ir Apache uzstādīti:
find / apachectl | grep apachectl atrast / 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. Daži Apache var instalēt in / usr / sbin / apachectl, vai varat izmantot httpd vai apachectl simboliskas saites / etc / rc.d / init.d / apachectl vai / etc / rc.d / init.d / httpd.
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: lapa mašīna iztulkot un pasniegts tàds, "kàds tas ir" bez garantijas. Machine translation may be difficult to understand. Mašīntulkošanas var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- Start, Stop and Restart Crond Daemon in Linux Start, Stop un Restart Crond Daemon Linux
- Starting Apache HTTPD Failed Due to Cannot Open or No Such mod_bwlimited, mod_log_bytes or mod_bandwidth Files Starting Apache httpd neizdevās, jo Cannot Open vai šāds mod_bwlimited, mod_log_bytes vai mod_bandwidth Faili
- Automatically Shutdown Computer With Auto Shutdown Genius Automātiski Shutdown dators ar Auto Shutdown Genius
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 4 Instalēšana Web Server 6.0 FreeBSD ar 2.2 Apache, MySQL 5.0 un PHP 5 - Part 4
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Kā atspējot Linux un Unix Cron Jobs (Crontabula) Email Sending
- How to Restart (Stop or Start) cPanel Service (cpsrvd) via Telnet or SSH Kā Restart (Stop vai uzsākšana) cPanel Service (cpsrvd) caur Telnet vai SSH
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 5 Instalēšana Web Server 6.0 FreeBSD ar 2.2 Apache, MySQL 5.0 un PHP 5 - Part 5
- Request URL /server-status or 404 Page Not Found Apache Error Pieprasījums URL / server-status vai 404 Page Not Found Apache Kļūda
- Restart or Shutdown Windows (XP, 2000 and Vista) from Command Line or One-Click Shortcut Atsākt vai Shutdown Windows (XP, 2000 un Vista) no Command Line vai One-Click Ātrais
- cPanel Unable or Cannot Start or Restart POP3 Mail Service cPanel nespēj vai nevar sākt vai atsākt POP3 Mail Service









































