Linux & Alsa: Toggle speakers off remotely, from ssh

Today I’ll stay home instead going to the Amsterdam office. I have a terrible headache and i stay better on the dark-silence.

But i want to stay in touch with the office so i start my email, chat, and other web apps, but  suddenly I realize that probably in the office, my colleagues hear a sound for each chat, email i receive and calendar alarms as well.

So I wanted to shut down my pc speaker in the office from ssh.

What i did was typing into a ssh shell:

amixer sset Master toggle

For next time, since I don’ trust my memory, I created a shell script with just that line into it, so i could call it with a easy name like “volume”. (If you too want to do so, remember to add “#!/bin/bash” on the very first line of the script otherwise you have to call the shell together with the script, in other words you need to feed the shell with the script as argument).
Then Chmod it in order to be executable

chmod +x volume

And if you want to do it 100% complete, just move the file you created into /usr/bin, so it will be possible to call that file without the complete path, like a system binary.

Ciao

P.s.

I added a cron job right some minutes after my usual leaving time in the office so, i don’t have to concern about this any longer. 🙂

P.P.s.

This one is nice because it doen’t toggle but it can set a precise percentage amount of volume:

amixer -c 0 cset iface=MIXER,name="Master Playback Volume",index=0 50%
(Visited 949 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.