4

We have 15 PCs in our network. If there is a big meeting, we want to play a sound (from a file, just some seconds) on all PCs in our network.

Most of them run Ubuntu, some run SuSE.

How can I solve this?

j0h
  • 14,825
guettli
  • 1,777
  • What is the source if this sound? – mbiber Mar 01 '16 at 13:53
  • @mbiber the source is a file on disc on a server. – guettli Mar 01 '16 at 17:01
  • Is it important for them to start at the exact same moment? What is the purpose for this - why play the file on all PCs? – mbiber Mar 01 '16 at 17:43
  • @mbiber a delay of up to 5 seconds is ok. Why play the file: to inform people. – guettli Mar 01 '16 at 19:09
  • 1
    Can you SSH into all those PCs? Do they all have access to the network location where the file is stored? Use play command to play the file. So something like ssh user@hostname play /location/of/file.mp3 on each of the PCs. If up to 5 seconds delay is ok then you can simply use for loop to run that command. Something like for PC in list of hostnames; do ssh user@$PC "play /location/of/file.mp3" &; done – mbiber Mar 02 '16 at 14:36
  • @mbiber yes, ssh to the hosts could work. Please write this as answer, and I will up-vote it. Thank you. – guettli Mar 03 '16 at 07:21
  • @mbiber Don't forget that ssh with password authentication will stop and wait till you enter the password. You need to set key authentication if you wish this script to run seamlessly. – whtyger Mar 04 '16 at 12:52
  • 1
    I think your question is not clear enough. It is very case specific but almost you haven't provided detail about it. – Mostafa Ahangarha Mar 04 '16 at 18:37
  • @MostafaAhangarha what details are you missing? What do you want to know? – guettli Mar 05 '16 at 14:59
  • You want to stream a sound or play an audio file? – Mostafa Ahangarha Mar 05 '16 at 15:04
  • @MostafaAhangarha I want to play a simple file from the file system. Just some seconds long. I updated the question. – guettli Mar 05 '16 at 20:13

2 Answers2

4

Use play command to play the file. So something like ssh user@hostname play /location/of/file.mp3 on each of the PCs. If up to 5 seconds delay is alright then you can simply use a for loop to run that command from any PC. Something like for PC in list of hostnames; do ssh user@$PC "play /location/of/file.mp3" & done.

Setting up public key authentication will eliminate the need for password inputting for each of the hosts. How can I set up password-less SSH login?

mbiber
  • 840
  • 5
  • 12
  • 1
    You may want to link to parallel to avoid scripting. "a shell tool for executing jobs in parallel using one or more computers": https://www.gnu.org/software/parallel/ – Marcus Mar 10 '16 at 02:41
0

I think streaming audio in your network can be a solution for your case.

have a look on this question: How to stream music over the network to multiple computers?