LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Send email when Remote Desktop is not available (https://www.linuxquestions.org/questions/linux-newbie-8/send-email-when-remote-desktop-is-not-available-4175535116/)

aavika 02-25-2015 11:29 PM

Send email when Remote Desktop is not available
 
hii..
I would like my computer to send me an email every time a remote desktop connection is not available.
Thanks in advance..:)

sudowtf 02-26-2015 08:20 AM

that's so vague.

what's the remote desktop server software? what port is it on? if you lose remote desktop, do you lose ping? can a solution be to test ping instead of remote?

what email service? do you have a sendmail server or will you use google or other?

you will not get a solution with such a vague question.

aavika 02-27-2015 01:38 AM

Sorry sorry for inconvenience...

Remote Desktop Connection is a technology that allows you to sit at a computer (sometimes called the client computer) and connect to a remote computer (sometimes called the host computer) in a different location.
For example, you can connect to your work computer from your home computer and have access to all of your programs, files, and network resources as though you were in front of your computer at work. You can leave programs running at work and then, when you get home, you can see your work computer's desktop displayed on your home computer, with the same programs running.

yeah if i lose ping then i lose remote desktop. i want when remote desktop is not working or not available, it should send an email. i dont have any sendmail server. what to do??
thnk u for d reply..:)

sudowtf 02-27-2015 07:44 AM

oh goodness, i know what remote desktop is; what software (name and version) are you using on the host?

sudowtf 02-27-2015 08:32 AM

You can go about this in several ways. you can ping the host and perform a function based on the result.
Let's assume your host is 192.168.1.100
Code:

if ! ping -c 1 -W 1 192.168.1.100 2>&1>/dev/null ; then echo "offline" ; else echo "online" ; fi
Another way is to test if a remote port accepts connections.
Let's assume your host is running RDP on port 3389.
Let's assume you have netcat installed on your linux client.

Code:

if ! nc -vz -w 2 192.168.1.100 3389  ; then echo "offline" ; else echo "online" ; fi
you could easily expand this to do some sendmail -- i will not go into that.
here is a link concerning sending gmail from commandline: http://tuxtweaks.com/2012/10/send-gm...-command-line/

Habitual 02-27-2015 08:49 AM

Quote:

Originally Posted by aavika (Post 5324110)
...if i lose ping then i lose remote desktop.

ping is not reliable as a test as some hosts can be set to drop ICMP packets.
Quote:

Originally Posted by sudowtf (Post 5324232)
Code:

if ! nc -vz -w 2 192.168.1.100 3389  ; then echo "offline" ; else echo "online" ; fi

Good one.

aavika 03-02-2015 11:35 PM

hey, it works, i got the solution..
thank u so much Sudowtf Habitual....

Habitual 03-03-2015 10:08 AM

You are very welcome.

aavika 03-04-2015 12:45 AM

i have a question:
how does swap partition size affect the performance of large files transfer??

aavika 03-04-2015 12:45 AM

i have a question:
how does swap partition size affect the performance of large files transfer??

aavika 03-04-2015 01:06 AM

i have a question:
how does swap partition size affect the performance of large files transfer??


All times are GMT -5. The time now is 09:12 AM.