Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

U

uniquerockrz

Guest
I had to get out of the house yesterday due to some work and I also had a few downloads and installs to do in my PC. Literally I had no way to get to know whats the progress except by calling my mom every hour and tell her to look in the screen and say whats going on. So I wrote this simple bash script that sends an email to my way2sms mailbox which is linked with my phone so that I get sms alerts (free :D ) of whats going on..

To do this you need to have:
1. A Linux system with bash
2. A way2sms a/c with mail alerts on.
3. Mutt (a console based email client) properly configured.
4. A non-DND activated number.

If you need to install mutt you can go the usual way according to your disto's package manager (e.g. apt-get install mutt). After that you have to properly configure it so that it can send and recieve e-mails. See this page for properly configuring it wilh Gmail IMAP and SMTP.

Next go to your way2sms a/c and click on "Mail Alerts" from the menu. There you will get a email address like 1234@way2sms.com. The specialty of this address is that whenever someone mails you here, you will get an SMS alert in you cellphone indicating the sender and subject of the mail.

If you have a DND activated number, you may need to disable it to use this feature. Call 1909 or SMS STOP DND to 1909.

Next have a look at the bash script of what I did.
Code:
wget *www.example.com/file1.tar.gz
mutt -s "File 1 Downloaded sucessfully" 1234@way2sms.com < hello.txt
apt-get install mypackage
mutt -s "mypackage installed sucessfully" 1234@way2sms.com < hello.txt
wget *www.example.com/file2.tar.gz
mutt -s "File 2 Downloaded sucessfully sucessfully" 1234@way2sms.com < hello.txt

Replace 1234@way2sms.com with your way2sms email address. Save the file in some name (like tasks.sh) and make it executable by using the command chmod +x filename.sh. Note that I have also used a file "hello.txt" here, you can create a blank file in gedit and save the file in your home folder. This file serves as the body of the email message. As the body is not displayed (only subject of email is displayed) in the SMS alert, you may leave this file blank or fill it with some bogus text.

Execute the shell script by opening the terminal and typing ./filename.sh. There you go! You will get free SMS alerts on your cellphone of whats going on in your PC, no matter wherever you are, what you are doing.

Some Tips:
1. I have specified here only two types of tasks, downloads and installs. In fact you can include any valid Linux commandline tasks (like moving files, deleting files etc). The format will be as follows:
Code:
task one command
mutt -s "task one done" 1234@way2sms.com < hello.txt
task two command
mutt -s "task two done" 1234@way2sms.com < hello.txt
.....

2. If you want to automatically shutdown your PC when all the tasks are done, be sure to add this at the end of the shell script.
Code:
mutt -s "All tasks done! Shutting Down now" 1234@way2sms.com < hello.txt
init 0
#or you may also write shutdown now instead of above command

3. If you specify tasks that require root access, be sure to execute the script with sudo privilages, e.g.
Code:
sudo ./tasks.sh

4. If you want more details of the tasks such as % of file downloaded, you way redirect the output of wget to a file and setup a cron job to email that file as a subject to your way2sms email every 10 minutes or so. Advanced stuff, but cool.
 
OP
U

uniquerockrz

Guest
I dont know if mutt is available for Windows, if it is, you can port it to windows too
 
Top Bottom