From d7dd5e23da1b44b8c2f716a460421cd5c49e98e6 Mon Sep 17 00:00:00 2001 From: Robert Manner Date: Fri, 17 Jun 2016 10:27:06 +0200 Subject: [PATCH] etc: adds a systemd service to autostart zukebox with screen --- README.md | 19 +++++++++++++++++++ etc/systemd/system/zukebox.service | 13 +++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 etc/systemd/system/zukebox.service diff --git a/README.md b/README.md index cc7dd1b..234292e 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,25 @@ The easiest way to install most Python packages is via ``easy_install`` or ``pip $ easy_install zukebox +Installing as a systemd daemon +------------------------------ + +Starting automatically with systemd (you might need to modify username/path): + + $ cp -a etc/systemd/system/zukebox.service /etc/systemd/system/zukebox.service + $ chmod 664 /etc/systemd/system/zukebox.service + $ systemctl daemon-reload + $ systemctl start zukebox # (optional) try if it works + $ systemctl enable zukebox + +ZukeBox is started with screen, so eg you can attach to it by: + + $ screen -r + +(Make sure you are the same user you are running zukebox with.) + +After this, pressing "Ctrl+a" "d" moves it back to the background. + Usage ----- diff --git a/etc/systemd/system/zukebox.service b/etc/systemd/system/zukebox.service new file mode 100644 index 0000000..8a762aa --- /dev/null +++ b/etc/systemd/system/zukebox.service @@ -0,0 +1,13 @@ +[Unit] +Description=ZukeBox With Screen +After=network.target + +[Service] +Type=forking +User=alarm +ExecStart=/usr/bin/screen -d -m -S zukebox /home/alarm/zukebox/bin/zukebox +ExecStop=/usr/bin/killall -w zukebox +WorkingDirectory=/home/alarm + +[Install] +WantedBy=multi-user.target