Tuesday, August 3, 2021

Restarting Services on Your Server

 The services on the server, often known as daemons, can be restarted with the aid of several methods. Daemons can be described as processes, which keep running in the server’s background. The need to restart a service might appear when either the configuration of the service gets changed or when the service encounters some issue.

It needs to be mentioned that if the hostname is updated, then user access to certain services and interfaces, such as CalDAV and CardDAV (Calendars and Contacts) as well as Horde Webmail is temporarily blocked by the system. Access to these interfaces and services is restored by the system after the hostname update gets completed.

To digress, a server is either a computer program or a piece of hardware that provides certain functionality to devices or programs that are known as clients. This functionality is delivered over a network and can be resources, services, data or programs. A distribution application structure, known as the client-server model, is used for this purpose. Devices or programs initiate communication sessions with servers, wherein the servers wait for the incoming requests sent by the clients. This communication that takes place between the clients and the servers usually happens over a computer network. A client requests for content or service from a server.

There are many types of servers, such as database servers, mail servers, file servers, print servers, game servers, application servers, web servers, etc. Web servers are used by web hosting companies for providing the service of web hosting which makes it possible to access websites online. Be it the “Best Cloud Hosting Company”, the “Best Windows Hosting Company” or the “Best Website Hosting Company”, every hosting company needs web servers on which the files (content) of websites are stored and delivered from. When these files are received by the Internet connected devices that had requested for the content online, then the web content becomes accessible to them. Web hosting companies provide all the necessary services and technologies for this purpose through their various web hosting plans.

Returning to the main topic, there are certain important points that need to be mentioned. Whenever the hostname of the server gets changed, one of the below-mentioned methods need to be used for ensuring that all the required system and service changes take place.

  • Calling WHM API 1's sethostname function
  • Using the Change Hostname interface in WHM.

WHM >> Home >> Networking Setup >> Change Hostname.

  • Running the /usr/local/cpanel/bin/set_hostname utility. This needs to be run as the root user.

Restarting Services in WHM

The Restart Services interface in WHM can be used for restarting most of the services.

Home >> Restart Services

Restarting Services from the Command Line

If IPv6 is used, then the IPv6 addresses are removed from the network device by the service network restart command. You need to run the command that is the most appropriate for your version of cPanel & WHM, in order to restart your IPv6 configuration, post running the service network restart command. For the version 11.52 and earlier versions of cPanel & WHM, you need to run the command, /etc/init.d/cpipv6 restart after restarting the network service. For the version 54 and later versions of cPanel & WHM, you need to run the command, /scripts/restartsrv_cpipv6 after restarting the network service.

Using the Script, restartsrv

The command, /usr/local/cpanel/scripts/restartsrv_* can be used to try to restart such a service from the command line that does not start from WHM. The “*” needs to be replaced with the correct value for that service, when the aforementioned command is run.

Direct Service Restart

When the script, /usr/local/cpanel/scripts/restartsrv_* does not prove to be useful in restarting the service, it is possible to try to restart the service directly.

The command, /etc/rc.d/init.d/service restart needs to be used for those servers that run Amazon Linux, CloudLinux, Red Hat® Enterprise Linux (RHEL) 6, or CentOS. In it, the path to the service is, /etc/rc.d/init.d/service.

The command, systemctl restart service-name.service needs to be used for those servers that run RHEL 7, CentOS 7, CloudLinux 7. In it, the service-name is the service that needs to be restarted.

Service Error Logs

In the event that the restart fails, you need to check the error log of the service to avail help for diagnosing the problem. You will have to check the documentation of the service in order to know the location of the error log. This needs to be done because the errors are logged differently by each service. Let us touch upon the common locations with regard to the error logs of some services.

  • Apache web server – Its log location is /usr/local/apache/logs/error_log
  • BIND nameserver – Its log location is /var/log/messages
  • ProFTP FTP server – Its log location is /var/log/messages
  • Pure-FTP FTP server – Its log location is /var/log/messages
  • Exim Mail Transfer Agent (MTA) – Its log location is /var/log/exim_mainlog for detailing all Exim transactions.
  • Exim Mail Transfer Agent (MTA) – Its log location is /var/log/exim_rejectlog for detailing rejected messages and reasons.
  • Exim Mail Transfer Agent (MTA) – Its log location is /var/log/exim_paniclog for detailing configuration and similar errors. It needs to be mentioned here that Exim will not run on some distributions and will have serious problems if this log is not empty.
  • Courier mail server – Its log location is /var/log/maillog. It needs to be mentioned that the Courier mail server has been removed in cPanel & WHM version 54. The Courier mail server is present only in version 11.52 and the earlier versions of cPanel & WHM.
  • Dovecot mail server – Its log location is /var/log/maillog
  • MySQL database server – Its log location is /var/lib/mysql/hostname.err

In it, you need to substitute “hostname” with the hostname of your server.

  • OpenSSH secure shell service – The location of the log file will depend on the syslog service’s configuration. Its log locations are - /var/log/messages, /var/log/secure, and /var/log/auth

Before concluding, it is important to mention some important facts in the context of web servers and the service of web hosting. Powerful server performance and high uptime are the most important factors to consider when opting for any web hosting service, regardless of its type (shared, dedicated, reseller, VPS, cloud, WordPress). Apart from that, the essential features that need to be present in an ideal web hosting plan, to provide the best hosting experience are fast page loads, secure hosting service, data backup facility, 24*7 technical support. All of these as well as many other features are an integral part of every web hosting plan of HTS Hosting along with highly affordable pricing. The web hosting plans of HTS Hosting cater to every budget segment and a wide range of hosting requirements to ensure an outstanding web hosting experience for all its global clients.

Source: https://www.htshosting.org/knowledge-base/server/248/restarting-services-on-your-server

No comments:

Post a Comment

Cloud Hosting Service from HTS Data Centre

  HTS Hosting is a globally renowned service provider of all types of web hosting services, including its highly specialized Cloud hosting ...