You are not logged in.

#1 2015-02-15 02:35:58

danifbento
Member
Registered: 2015-02-15
Posts: 3
Website

PKGBUILD and systemd

Hello,

I'm creating a package for a key value data store and I'm trying to install the systemd service too.

I have something like this:

[Unit]
Description=Kyoto Tycoon key-value server (and Kyoto Cabinet library)
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/run/kyoto.pid
PrivateDevices=yes
SyslogLevel=err
Restart=on-abort	
User=kyoto
Group=kyoto

EnvironmentFile=/etc/conf.d/kyoto
ExecStartPre=/bin/rm -f '/run/kyoto.pid'; chown kyoto.kyoto /var/log/kyoto.log
ExecStart=/usr/bin/ktserver -dmn -pid /run/kyoto.pid -log /var/log/kyoto.log $KTSERVER_OPTS
ExecReload=/usr/bin/kill -HUP /run/kyoto.pid
KillSignal=SIGQUIT
KillMode=mixed

[Install]
WantedBy=multi-user.target

The service starts and stops but, when I do:

# systemctl start kyoto.service, it starts and hangs in the terminal. I have to Ctrl-C for exit, but the service keeps running normally until I do a stop.

How can I avoid to have the service waiting in the terminal? Maybe I'm doing something wrong.

Thanks,
Dani

Last edited by danifbento (2015-02-15 13:24:48)

Offline

#2 2015-02-15 02:46:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: PKGBUILD and systemd

Please use code tagswhen posting code or file contents as it makes it more readable.

The semicolon in the ExecStartPre line must be separated from the first command by a space:

man systemd.service wrote:

Multiple command lines may be concatenated in a single directive by separating them with semicolons (these semicolons must be passed as separate words).

Also, are you sure kyoto forks itself?  If you just run ktserver from the command line, are you immediately returned to a prompt, or does it take time to start up?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2015-02-15 02:52:57

progandy
Member
Registered: 2012-05-17
Posts: 5,193

Re: PKGBUILD and systemd

Maybe you are missing permission to create the pidfile, so systemd never sees that the service is ready.
Edit: By the way, you don't have to do work with the logfile. You could use the default output to stdout and let systemd send it all to journald.

Last edited by progandy (2015-02-15 02:57:08)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2015-02-15 13:29:54

danifbento
Member
Registered: 2015-02-15
Posts: 3
Website

Re: PKGBUILD and systemd

Hello,

Thanks for the answers (I updated the post to more readable with de code tag)

The problem was in the PID file. I have configured to create it at /run/kyoto.pid, but the service is running with kyoto user permissions.

I put in the kyoto.conf (for the tempfiles.d) the line:

D /run/kyoto 0755 kyoto kyoto -

And change the PID file to /run/kyoto/kyoto.pid an now it's running well! Thanks a lot!

I also removed the log file, how can I see the specific kyoto service lines in the journald? Is it need to configure anymore thing in the service?

Thanks a lot!

Offline

Board footer

Powered by FluxBB