Open ahazelwood opened 7 years ago
I've created /etc/init.d/ script for cerebro. May share it here
For systemd servers (CentOS 7) you can create service script relatively easily.
vi /etc/systemd/system/cerebro.service
`[Unit] Description=Cerebro
[Service]
Type=simple
User=root
Group=root
ExecStart=/
[Install] WantedBy=multi-user.target`
systemctl daemon-reload systemctl enable cerebro systemctl start cerebro
~Regards
@ahazelwood For upstart you can use:
description "Cerebro plugin"
start on runlevel [2345] stop on runlevel [06]
script exec start-stop-daemon --start --quiet --exec /usr/local/cerebro-0.6.4/bin/cerebro end script
Just change the path to the bin.
@Amorik the cerebro.service should be in /usr/lib/systemd/service for Centos 7.x, no?
@jptoto probably? both work for me, but I'm sure one is more "right" than the other.
My upstart script:
#!upstart
description "Cerebro"
start on startup
stop on shutdown
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/cerebro.pid --chuid cerebro --exec /opt/cerebro/bin/cerebro -- -Dhttp.address=127.0.0.1 >> /var/log/cerebro.log 2>&1
You'll need a cerebro
user which owns the cerebro folder.
@Amorik I think root is not necessary for cerebro, I strongly recommend to use own user for it's purposes. Also why you set WorkingDirectory to / ?
@alkuzad Agreed. It was a hasty copy from one of my dev boxes. As for the working directory no reason. In prod it was placed nearby the install folder.
Hi, if anyone interested I reworked init script for kibana to work for cerebro. Nothing special you just need create user to run cerebro and of course change rights on directory.
kudos to @Amorik for his systemd
script. It works wonderfully on Ubuntu as well.
For reference, my Cerebro lives in /opt
, and is symlinked to /opt/current
, so my version looks like this:
npeelman@oliver:~$ cat /etc/systemd/system/cerebro.service
[Unit]
Description=Cerebro
[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/cerebro/current/bin/cerebro "-Dpidfile.path=/var/run/cerebro.pid"
Restart=always
WorkingDirectory=/opt/cerebro
[Install]
WantedBy=multi-user.target
npeelman@oliver:~$
# useradd -r -b /opt -m cerebro
# ll /opt/
drwx------. 2 cerebro cerebro 59 26. Oct 19:40 cerebro
# id cerebro
uid=993(cerebro) gid=990(cerebro) groups=990(cerebro)
# /etc/systemd/system/cerebro.service
...
User=cerebro
Group=cerebro
RuntimeDirectory=cerebro
...
I would love to be able to have cerebro run startup. However I can't figure out how to create a service template for cerebro.
Thanks.