You are not logged in.

#1 2014-08-05 19:55:24

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED]systemd service doesn't play sound

I have a bash script which play via 'sox' a sound file. Something like this:

play someFile -t alsa -q

I set up a 'systemd --user' timer which calls this script at certain time. The timer is successfully called and the corresponding service is also successfully called and exits with SUCCESS code. The problem is that sound is not heared.

When the service is called manually from the bash with

systemctl start mySoundTimer.service

the sound is played OK.

The service file is as follows:

[Unit]
Description= A sound timer.

[Service]
Type=simple
ExecStart=/usr/bin/bash /path/to/my/script.sh

I tried several other combinations in ExecStart:

ExecStart=/usr/bin/bash -c /path/to/my/script.sh
ExecStart=/usr/bin/bash "-c /path/to/my/script.sh"
ExecStart=/usr/bin/bash -c "/path/to/my/script.sh"

No one is working. What can be the cause of the problem?

EDIT:

The cause of this is a different timing behaviour of systemd timer as compared to cron which I used before. (It seemingly takes into account the time of the last run and does not run again if it is called in less than the interval between runs specified in the timer file. And I tested the timer by setting the system date to several seconds before the timer's planned times.)

Last edited by nbd (2014-08-05 20:23:39)


bing different

Offline

Board footer

Powered by FluxBB