OpenCA service can be started using the
SysVinit script located inside
openca/etc/init.d folder. However, the script has to be started manually after every system reboot (otherwise, the script could have been scheduled as cron job!). How about adding the script to
Systemd so that it can start automatically when the system boots up? In this tutorial, I’ll explain how to automatically start OpenCA service via Systemd in CentOS 7.
Solution: Either convert the old init script to systemd unit files or run a script via a systemd service. Here I’ll be showing the latter one.
Automatically start OpenCA service via Systemd in CentOS 7
To do this, you need two files:
- The script which OpenCA already provides:
/home/openca/etc/init.d/openca(Make sure the script is executable and the first line is
.service file in
/etc/systemd/system folder as
Add the below code:
[Unit] Description=OpenCA Start script at boot After=network.target [Service] Type=forking ExecStart=/home/openca/etc/init.d/openca start ExecStop=/home/openca/etc/init.d/openca stop TimeoutStartSec=0 [Install] WantedBy=default.target
Make sure you update the path accordingly. Once you’re done with the files, you need to reload the daemons and then enable the service as below:
#systemctl enable openca
Once enabled, you can start and stop your OpenCA service as any other service on CentOS 7.
To start OpenCA service
#systemctl start openca
To stop OpenCA service
#systemctl stop openca
is a Web Designer and content creator. A freelance writer on latest trends in technology, gadget reviews, How to’s and many more.