LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-22-2011, 11:32 AM   #1
sangal_ak04
LQ Newbie
 
Registered: Sep 2008
Posts: 27

Rep: Reputation: 0
Angry CYGWIN - sendmail - cronlog - Email issue Linux Windows


Hi ALL

Situation:
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.


Regards
Arun Sangal
 
Old 07-23-2011, 11:12 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -
Quote:
http://cygwin.com/ml/cygwin/2010-07/msg00025.html

So you've installed the cron package and nothing else that provides 'sendmail'.
Take a look at '/etc/postinstall/cron.sh.done' and/or the email archives if
you're curious about the details.
Frankly, if I were in your situation, I probably would have just written something in VBScript and kept two parallel script versions - one for Windows, one for Linux.

But in your case, you probably just need to find, install and configure a mail transport agent (MTA). I understand that "exim" is a very good candidate for use with Cygwin. Google for "cygwin SMTP Exim" and you'll find several hits, including this one:

http://infrablue.tripod.com/cygwin3.html
 
Old 09-25-2012, 02:34 PM   #3
sangal_ak04
LQ Newbie
 
Registered: Sep 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Smile

I couldn't dig deep into that but got a workaround.

The main purpose of using cygwin was to use shell script and get it running on a Windows environment.

We came up with plan where..

all Linux builds / deliverables (.tar. etc or any file which is a deliverable i.e. output of a build process) ... go to a Linux Shared NAS location called /Some_shared_nas_on_linux/Linux/Project1/BuildArchive/BuildLabel/builddeliverable{1,2,..}.anyextension

similarly, whereever our Windows products were throwing their deliverables, we created such kind of structure on Windows shared NAS as well.. and then, had our Linux guy.. MOUNT that Windows shared NAS on Linux shared nas at the following path.

/Some_shared_nas_on_linux/Windows/Project1/BuildArchive/BuildLabel/builddeliverable{1,2,..}.anyextension

(note this above................^^^ location is actually a mapped/mounted Windows location on linux shared NAS /Some_shared_nas_on_linux/..



That's it. I ran my script from Linux box... no buzz about cygwin anymore as on a file system level, it doesn't matter whether the files have been built by a Linux build process or a windows build process, I just see them and use them for whatever purpose.

Last edited by sangal_ak04; 09-25-2012 at 02:36 PM.
 
  


Reply

Tags
cron, cygwin, linux command, sendmail


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't send email from linux machine using sendmail Zero187 Linux - General 2 06-24-2009 02:33 PM
'Having whatever Linux' working like cygwin under MS-Windows ?? Xeratul Linux - Software 2 06-04-2007 01:24 PM
Creating A Second Email Address For Email Account On Sendmail treedstang Linux - Software 1 04-27-2004 10:31 PM


All times are GMT -5. The time now is 01:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration