Services command line options

Restarting the services that run on the server is one of the common tasks, the services includes Apache, mail, ftp etc. The related service must be restarted to get the changes to take effect if changes are made to any of them. There arise situations at times where the services needs to be restarted when the server load is high, due to crashing or to have configuration change to take effect.

Below are some examples of various common services and their usage flags:

Apache: The Apache need to be restarted after changes have been made to its configuration file, the changes are made mainly to optimize Apache.
root@nixlinux# /etc/init.d/httpd usage: /etc/init.d/httpd (start|stop|restart|fullstatus|status|graceful|configtest|help)

start – start httpd
startssl – start httpd with SSL enabled
stop – stop httpd
restart – restart httpd if running by sending a SIGHUP or start if
not running
fullstatus – dump a full status screen; requires lynx and mod_status enabled
status – dump a short status screen; requires lynx and mod_status enabled
graceful – do a graceful restart by sending a SIGUSR1 or start if not running
configtest – do a configuration syntax test
help – this screen

Mail : The default mail service is exim on cPanel servers, any configuration changes to it will require a restart of the service.
root@nixlinux# /etc/init.d/exim Usage: exim {start|stop|restart|status}

On Plesk servers the default mail service is qmail. Any configuration changes to qmail will require a restart to take effect.
root@nixlinux# /etc/init.d/qmail Usage: /etc/init.d/qmail {start|stop|status|reload|condrestart|restart}

Any change to the ssh configuration file(such as changing the SSH port) require a restart to take effect.
root@nixlinux# /etc/init.d/sshd Usage: /etc/init.d/sshd {start|stop|restart|reload|condrestart|status}

On cPanel servers the default FTP program is pure-ftp, as you know it requires a restart when changes have been made.
root@nixlinux# /etc/init.d/pure-ftpd Usage: {start|stop|restart|condrestart|status}
root@nixlinux# /etc/init.d/mysql Usage: /etc/init.d/mysql start|stop|restart|reload
It is one of the most common tasks that we need to restart the firewall/IPtables after making any changes to its configuration.
root@nixlinux# /etc/init.d/iptables Usage: /etc/init.d/iptables {start|stop|restart|condrestart|status|panic|save}
For advanced policy firewall(APF), do the following. root@nixlinux# /etc/init.d/apf usage: /etc/init.d/apf [start|stop|restart]
On linux the cron service controls the scheduled tasks that run on the server.
root@nixlinux# /etc/init.d/crond Usage: /etc/init.d/crond {start|stop|status|reload|restart|condrestart}

System Logging
The syslog service controls the system and kernel logging for the server.
root@nixlinux# /etc/init.d/syslog Usage: /etc/init.d/syslog {start|stop|status|restart|condrestart}
That’s it 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *