Redhat7:Managing services
Jump to navigation
Jump to search
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 |