serviced

How to configure OpenTSDB (or any process) as a systemd service in CentOS 7?

CentOS 7 uses Systemd for managing services (prior to CentOS 7 it was using upstart-init.d to manage the services). Step-1: Create CentOS 7 Service file: vim /usr/lib/systemd/system/opentsdb.service [Unit] Description=OpenTSDB Service After=network.target hbase.service [Service] Type=forking PrivateTmp=yes ExecStart=/usr/share/opentsdb/etc/init.d/opentsdb start ExecStop=/usr/share/opentsdb/etc/init.d/opentsdb stop Restart=on-abort [Install] WantedBy=multi-user.target Step-2: Let’s test the start and stop of this new OpenTSDB service $ sudo systemctl start opentsdb # If it starts up good, you should see the website when you goto http://<servername>:4242/ ps -leaf | grep "tsdb" # shows you something similar then you can add it as a service to auto-start sudo systemctl enable opentsdb Step-3: (optional) Reboot node and make sure that the service starts up accordingly after a reboot.