On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

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

Posted by Venkatt Guhesan on March 23, 2016

centos_logoCentOS 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

Description=OpenTSDB Service hbase.service

ExecStart=/usr/share/opentsdb/etc/init.d/opentsdb start
ExecStop=/usr/share/opentsdb/etc/init.d/opentsdb stop


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.

If you want to learn more about the available options under systemd refer to this link here.

Some useful options to learn are:
ExecStartPre=, ExecStartPost=

Some other examples for including options like the ones below can be seen here:

ExecStart=/usr/sbin/grafana-server                                \
                            --config=${CONF_FILE}                 \
                            --pidfile=${PID_FILE}                 \
                            cfg:default.paths.logs=${LOG_DIR}     \
                  ${DATA_DIR}    \

Additionally here is one more resource.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: