Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 22-12-2011, 01:16 PM   #1 (permalink)
Linux Struggler
 
uniquerockrz's Avatar
 
Join Date: Feb 2011
Location: Kolkata
Posts: 15
Smile Free SMS alerts of progress of PC tasks (eg. Downloads, etc)


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 ) 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 http://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 http://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.
__________________
My blog -> http://intoanotherdawn.tk
uniquerockrz is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 22-12-2011, 01:57 PM   #2 (permalink)
Simply a DIGITian
 
krishnandu.sarkar's Avatar
 
Join Date: Nov 2007
Location: Kolkata
Posts: 2,942
Default Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

Nice tutorial. Repped.

Can come handy for people who keep their PC on whole day, specially for torrent downloaders
__________________
  • Read The Forum RULES First.
  • Before PM'ing Or Asking Any Questions To Any Mod Read The FAQ's
  • Before Starting A New Thread Read The STICKY THREADS First
  • Before Participating In Bazaar Section Read The BAZAAR RULES
krishnandu.sarkar is online now   Reply With Quote
Old 22-12-2011, 09:36 PM   #3 (permalink)
Still A Student!!!
 
Join Date: Nov 2011
Location: Kolkata
Posts: 41
Cool Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

wish it was for windows 7
arnab.d287 is offline   Reply With Quote
Old 22-12-2011, 10:49 PM   #4 (permalink)
Wise Old Owl
 
clmlbx's Avatar
 
Join Date: Aug 2006
Location: Indore
Posts: 1,687
Default Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

nice for linux users.. ,, I dare you to make it for windows 7
__________________
Athlon II X4 635 @ 2.9Ghz   Gigabyte GA-MA785GMT-US2H   Kingston 2x2 Gb 1333Mhz DDR3   WDC 500Gb Green   Palit GTS 250 512mb   Tagan 500W   Samsung B2030   Lg DVD Writer
clmlbx is online now   Reply With Quote
Old 22-12-2011, 11:29 PM   #5 (permalink)
Linux Struggler
 
uniquerockrz's Avatar
 
Join Date: Feb 2011
Location: Kolkata
Posts: 15
Default Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

I dont know if mutt is available for Windows, if it is, you can port it to windows too
__________________
My blog -> http://intoanotherdawn.tk
uniquerockrz is offline   Reply With Quote
Old 23-12-2011, 01:09 AM   #6 (permalink)
Stuck in Time...
 
Vyom's Avatar
 
Join Date: May 2009
Location: Land of Logic
Posts: 2,269
Default Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

Nice tutorial....
Now just waiting to try it when I install Linux.
__________________
Marty: Hey, Doc, we better back up. We don't have enough road to get up to 88.
Doc Brown: Roads? Where we're going, we don't need, "roads!" :)

──── On the Internet you can be Anything you want. It's Strange that, so many people choose to be Stupid! ────
Vyom is online now   Reply With Quote
Old 23-12-2011, 02:32 AM   #7 (permalink)
NULL_PTR
 
Join Date: Jan 2006
Location: Dangling Pointer
Posts: 88
Default Re: Free SMS alerts of progress of PC tasks (eg. Downloads, etc)

Quote:
Originally Posted by arnab.d287 View Post
wish it was for windows 7
it is as mutt is available for windows too
__________________
Writing Mine Own Os
Wanna Join Pm ME
umeshtangnu is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:37 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2