1. I have written one Linux shell script which uses sendmail command to send a
nice HTML email.
2. This script is written in a sense that it can be used by any product in
Linux platform that my company supports.
3. Now, I want to use this same "global" script to work for any WINDOWS based
product as well that my company supports.
For ex: If my script is giving output as "what's the value of `hostname`" (which is servername), then it's running fine from any Linux product's machine (our company has). Now, to achieve this script to work from ANY WINDOWS based product machine, I want to run the same script which should output "System1" (if my Windows machine name from where I'll run this script is "System1") or blah blah...
To achieve this, I have installed "CYGWIN" and I'm using Mintty session (kind of putty screen, provided when I installed CYGWIN).
Now, when I'm running this script from the WINDOWS machine, this script is working perfectly fine (as expected, as the only line in the script is showing the value of hostname. Here I'm assuming that first line of the script is:
#!/bin/bash and then somewhere i have written, echo `hostname`; in the script).
NOW, the real question that I need.
If I want to add another line in the script to send the output of hostname command ....somehow to my email, I can easily do that. So, I used Linux/Unix "sendmail" command and when I ran it from Linux product machine, It ran perfectly (as expected). Now, I went to Windows - i.e. use CYGWIN Mintty session or any other (Cygwin putty or Cygwin own session), then this "sendmail" command written in the script is showing me an ERROR mesg as listed below
/usr/sbin/sendmail is a link to /usr/bin/cronlog.
It is only meant to be called from cron.
Now, I dont understand what's happening here behind the scene. Why Cygwin is not treating Linux sendmail command and running as it's running perfectly when I'm running it on a Linux machine. It's saying setup something in CRON or DO I NEED TO USE SOMETHING ELSE (instead of sendmail), that will run on both Linux and Windows.
Any help / direction is appreciated.
Thanks a lot.