Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
That will start it in the background, if it doesn't already, and the nohup frees it up from the parent process, which is the ssh console. Otherwise, when the console exits, mpg123 may also exit. Add at least a sleep 3 such as
nohup mpg123 -repeat &
That gives mpg123 time to fully spawn before the console exits.
here are the scripts, remember, security is not paramount: This runs on the server
#Archives old MP3's, and compresses new ones
#Set DATE variable to today
#Checks to see if there is a new wav file. Does nothing if there is not.
if ls /audio/ | grep -q wav &> /dev/null
#Copy old MP3's into an archive directory, then deletes
mv /audio/*.mp3 /audio/archive
#Encodes wav file into MP3
lame -a -h -S -p -b 96 /audio/*.wav /audio/$DATE.mp3&&rm /audio/*.wav
#Changes file permissions
chown root:root /audio/$DATE.mp3
#Forces clients to transfer new files
ssh -qi /root/.ssh/id_rsa -l root 10.85.16.222 "/root/update_audio"
ssh -qi /root/.ssh/id_rsa -l root 10.85.16.223 "/root/update_audio"
This runs on the clients (this is /root/update_audio):
#Updates file currently playing
#Moves old MP3's to a temporary location
mv /audio/*.mp3 /tmp/
#Copies new MP3's to /audio
if scp -i /root/.ssh/id_rsa email@example.com:/audio/*.mp3 /audio/ > /dev/null
#Remove old MP3's
chmod 644 /audio/*.mp3
#Move old MP3's back into original location upon failure
mv /tmp/*.mp3 /audio/
#Repeats new announcement forever
nohup mpg123 --random /audio/*.mp3&