Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the title says, I'm trying to stop Clementine playback using DBus before entering suspend mode. Here is my service file right now:

[Unit]
Description=Stop Clementine playback before suspend
Requires=dbus.service
Before=sleep.target
Before=dbus.service

[Service]
User=jo
Type=oneshot
ExecStart=-/bin/sh -c 'qdbus org.mpris.clementine /Player org.freedesktop.MediaPlayer.Stop'

[Install]
WantedBy=sleep.target

Now, this works, i.e. playback is stopped. However, systemd then proceeds to take a long time to actually enter suspend mode. Looking at the logs in journalctl, I see:

Jun 05 23:43:53 localhost.localdomain systemd[1]: Starting Suspend...
Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Error: org.freedesktop.DBus.Error.NoReply
Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Did not receive a reply. Possible causes include: the remote application did not send a reply, the 
Jun 05 23:44:18 localhost.localdomain systemd-sleep[7052]: Suspending system...

My first thought is that the DBus system, or maybe Clementine itself is suspended before it has time to reply, thus causing a hang. This is why I tried adding a dependency to the dbus service in my service file above. However, that does not do the trick.

Any ideas?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.