Hi all,
There is a java app that writes directly to the pulseaudio MASTER channel at full volume twice a day. I'm pretty sure the neighbors hear it. My idea is to use crontab to run at 12:59 Monday-Friday. It waits 59 seconds, mutes the audio, waits 6 more seconds and unmutes the audio. From the command line it works. I can't make it work using crontab. It does show up in the syslog.
This is in my /etc/crontab (all on one line)
59 12 * * 1-5 root test -x /usr/local/bin/mute && \ ( \ /bin/sleep 59 ; \ /usr/local/bin/mute ; \ /bin/sleep 6 ; \ /usr/local/bin/unmute \ )
This is /usr/local/bin/mute and unmute:
sink=$(pactl info | grep "Default Sink" | cut -d' ' -f3) pactl set-sink-mute "$sink" 1 (unmute uses 0)
Anybody explain why this doesn't do what I intend?
Thanks, Mike Wright
On Thu, 17 Feb 2022 17:39:18 -0800 Mike Wright wrote:
Anybody explain why this doesn't do what I intend?
Odds are good something in your login environment is required. DBUS_SESSION_BUS_ADDRESS is one good candidate. Lots of linux tools don't directly do anything, but instead connect to DBUS to talk to something else that does the work.
On 18 Feb 2022, at 01:53, Mike Wright nobody@nospam.hostisimo.com wrote:
Hi all,
There is a java app that writes directly to the pulseaudio MASTER channel at full volume twice a day. I'm pretty sure the neighbors hear it. My idea is to use crontab to run at 12:59 Monday-Friday. It waits 59 seconds, mutes the audio, waits 6 more seconds and unmutes the audio. From the command line it works. I can't make it work using crontab. It does show up in the syslog.
This is in my /etc/crontab (all on one line)
59 12 * * 1-5 root test -x /usr/local/bin/mute && \ ( \ /bin/sleep 59 ; \ /usr/local/bin/mute ; \ /bin/sleep 6 ; \ /usr/local/bin/unmute \ )
This is /usr/local/bin/mute and unmute:
sink=$(pactl info | grep "Default Sink" | cut -d' ' -f3) pactl set-sink-mute "$sink" 1 (unmute uses 0)
Anybody explain why this doesn't do what I intend?
Any output like errors will be emailed by cron. Try running /usr/bin/mail and see if you have emails with errors.
Personally I do not use cron anymore, I use system timer units. Then I can look in the journal —user for all logs from the service.
Barry
Thanks, Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
On 2/18/22 00:22, Barry wrote:
On 18 Feb 2022, at 01:53, Mike Wright nobody@nospam.hostisimo.com wrote:
There is a java app that writes directly to the pulseaudio MASTER channel at full volume twice a day. I'm pretty sure the neighbors hear it. My idea is to use crontab to run at 12:59 Monday-Friday. It waits 59 seconds, mutes the audio, waits 6 more seconds and unmutes the audio.
<snip/>
Personally I do not use cron anymore, I use system timer units. Then I can look in the journal —user for all logs from the service.
Thanks Barry,
Exposed me to systemd timers.
Project ended up with 2 timer/service pairs: mute and unmute
Each has two OnCalendar rules: one for morning timings, the other afternoons.
A further dig into pulseaudio utils and sounds ease away twice a day.
Nice...
On Thu, 2022-02-17 at 17:39 -0800, Mike Wright wrote:
There is a java app that writes directly to the pulseaudio MASTER channel at full volume twice a day. I'm pretty sure the neighbors hear it. My idea is to use crontab to run at 12:59 Monday- Friday. It waits 59 seconds, mutes the audio, waits 6 more seconds and unmutes the audio. From the command line it works. I can't make it work using crontab. It does show up in the syslog.
Is the offending app run in your name, are you logged in all the time? If so, perhaps running your mute function as a personal cron item rather than a system one.
I think any muting would have to be done as the same user as the app.
I presume you can't fix the app, perhaps you can nobble it. Can you replace the sound file it plays? Perhaps you can ban it from pulseaudio.