Redhat7:Managing services
Revision as of 15:27, 6 January 2015 by Michael (talk | contribs) (→Comparison of the chkconfig Utilty with systemctl)
Previously and Now..
In the old versions of Redhat services that used the SysV or upstart, had corresponding init scripts found in /etc/rc.d/init.d/ directory. These scripts could be modified as they were written in bash, and allowed the admin to control how and when the servics were started.
The init scripts have been replaced with systemd serice units. Each service unit ends with the .service file extension, but serve a similar purpose to the old init scripts.
The service units are used with the systemctl command, and while the service and chkconfig commands still exist they should be avoided.
Comparison of the service and systemctl commands
The examples below use the full .service notation, however the services can controlled while omitting this.
| Comparison of Serice Utility and Systemctl | ||
|---|---|---|
| Service | systemctl | Description |
| service name start | systemctl start name.service | Start a Service |
| service name stop | systemctl stop service.name | Stops a service |
| service name restart | systemctl restart name.service | Restarts a service |
| service name condrestart | systemcrl tyy-restart name.service | Restarts a service only if running |
| service name reload | systemctl reload name.service | Reloads Configuration |
| service name status | systemctl status name.service systemctl is-active name.service |
Checks is service is running |
| service -- status-all | systemctl list-units -- type service --all | Displays the status of all services |
Comparison of the chkconfig Utilty with systemctl
| Comparison of Serice Utility and Systemctl | ||
|---|---|---|
| chkconfig | systemctl | Description |
| chkconfig name on | systemctl enable name.service | Enable a Service |
| chkconfig name off | systemctl disable name.service | disable a service |
| chkconfig --list name | systemctl status name.service systemctl is-enabled name.service |
Checks if a service is enabled |
| chkconfig --list | systemctl list-unit-files --type service | List all service and check if they are anabled |