You are not logged in.

#1 2012-10-23 02:12:48

adambot
Member
Registered: 2012-01-24
Posts: 32

creating a systemd script for twonky [solved]

Greetings,

I found this on google however it doesn't seem to work: http://www.giulix.net/twonky_server

Basically i am trying to create a systemd script for twonky.  Here is my service file:

[Unit]
Description=Twonky service
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/local/twonky/twonky.sh start
ExecStop=/usr/local/twonky/twonky.sh stop
PIDFile=/var/run/mediaserver.pid

[Install]
WantedBy=multi-user.target

However, it is not working.  I put systemd in debug and here is the log for when i am trying to start twonky:

Oct 22 20:58:56 turian systemd[1]: Accepted connection on private bus.
Oct 22 20:58:56 turian systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.StartUnit() on /org/freedesktop/systemd1
Oct 22 20:58:56 turian systemd[1]: Trying to enqueue job twonky.service/start/replace
Oct 22 20:58:56 turian systemd[1]: Installed new job twonky.service/start as 78
Oct 22 20:58:56 turian systemd[1]: Enqueued job twonky.service/start as 78
Oct 22 20:58:56 turian systemd[1]: Starting Twonky service...
Oct 22 20:58:56 turian systemd[1]: About to execute: /usr/local/twonky/twonky.sh start
Oct 22 20:58:56 turian systemd[1]: Forked /usr/local/twonky/twonky.sh as 687
Oct 22 20:58:56 turian systemd[1]: twonky.service changed failed -> start
Oct 22 20:58:56 turian systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.GetUnit() on /org/freedesktop/systemd1
Oct 22 20:58:56 turian systemd[1]: Got D-Bus request: org.freedesktop.DBus.Properties.Get() on /org/freedesktop/systemd1/unit/twonky_2eservice
Oct 22 20:58:56 turian twonky.sh[687]: Starting /usr/local/twonky/twonkystarter ...
Oct 22 20:58:56 turian systemd[1]: Received SIGCHLD from PID 687 (twonky.sh).
Oct 22 20:58:56 turian systemd[1]: Got SIGCHLD for process 687 (twonky.sh)
Oct 22 20:58:56 turian systemd[1]: Child 687 died (code=exited, status=12/n/a)
Oct 22 20:58:56 turian systemd[1]: Child 687 belongs to twonky.service
Oct 22 20:58:56 turian systemd[1]: twonky.service: control process exited, code=exited status=12
Oct 22 20:58:56 turian systemd[1]: twonky.service got final SIGCHLD for state start
Oct 22 20:58:56 turian systemd[1]: twonky.service changed start -> final-sigterm
Oct 22 20:58:58 turian systemd[1]: Received SIGCHLD from PID 690 (twonkystarter).
Oct 22 20:58:58 turian systemd[1]: Got SIGCHLD for process 690 (twonkystarter)
Oct 22 20:58:58 turian systemd[1]: Child 690 died (code=exited, status=0/SUCCESS)
Oct 22 20:58:58 turian systemd[1]: Accepted connection on private bus.
Oct 22 20:58:58 turian systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Agent.Released() on /org/freedesktop/systemd1/agent
Oct 22 20:58:58 turian systemd[1]: twonky.service: cgroup is empty
Oct 22 20:58:58 turian systemd[1]: twonky.service changed final-sigterm -> failed
Oct 22 20:58:58 turian systemd[1]: Job twonky.service/start finished, result=failed
Oct 22 20:58:58 turian systemd[1]: Failed to start Twonky service.
Oct 22 20:58:58 turian systemd[1]: Unit twonky.service entered failed state.

Here is a ps output of what is running when i start it using the init script that twonky came with (twonky.sh)

root       717     1  0 21:11 ?        00:00:00 /usr/local/twonky/twonkystarter
root       718   717  8 21:11 ?        00:00:00 /usr/local/twonky/twonkyserver

[edit]
I found the answer -- by looking at the init script i was able to change the ExecStart and now it works.

Here is the working script:

[Unit]
Description=Twonky service
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/local/twonky/twonkystarter
ExecStop=/usr/local/twonky/twonky.sh stop
PIDFile=/var/run/mediaserver.pid

[Install]
WantedBy=multi-user.target

Last edited by adambot (2012-10-23 02:21:30)

Offline

Board footer

Powered by FluxBB