delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/21/14:33:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <8F23E55D511AD5119A6800D0B76FDDE101A26A9A@cpex3.channelpoint.com>
From: Troy Noble <troy DOT noble AT channelpoint DOT com>
To: "'Upat54wo AT aol DOT com'" <Upat54wo AT aol DOT com>, cygwin AT cygwin DOT com
Subject: RE: Shell execution
Date: Fri, 21 Sep 2001 12:32:30 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/)

From /usr/doc/Cygwin/cron.README:

"On NT/W2K run cron under SYSTEM account
as service to use that feature. Note that you don't have access to
net shares in the child processes then."

Which means m: (and thus /cygdrive/m) 
is likely not mapped when your cron job is running...
as you discovered.

Search the archives for similar discussions on this
subject.  A search on Google for cygwin +cron +mount +username
should do the trick I'd imagine.

A nifty little trick I've learned... if you don't mind
storing your NT username and password in a plain text file
somewhere on your disk (like in your script):


/winnt/system32/net use m: '\\hostname\sharename' yourpassword
'/user:YOURDOMAIN\yourusername'

and later before your script exits

/winnt/system32/net use /d m:

The security hole that this opens up should be obvious to
the casual observer... but it is effective nonetheless.

Troy

-----Original Message-----
From: Upat54wo AT aol DOT com [mailto:Upat54wo AT aol DOT com]
Sent: Friday, September 21, 2001 12:13 PM
To: cygwin AT cygwin DOT com
Subject: Shell execution 


I'm new to cygwin (latest) and NT (4.0 sp 6) but not to UNIX.   I am
experiencing a conflict between bash and cron execution and hope someone can
point out what I've missed. 

When I run a shell from the cygwin prompt/command line, it works fine.

When I schedule the same shell in cron, I get errors saying the files I'm
trying to grep on don't exist.   I am using an "*" in the filename because
there are several, as in file1.log, file2.log, file3.log, etc.

The script follows.

#!/bin/bash

SID=fprd
xwork=/tmp/check.wrk1
xdisk=/cygdrive/m/Backups/COLDBACKUPS/FPRD/Logs

cnt=$(grep -i '0 file' $xdisk/$SID_copyjob*.log | wc -l )
cnt=$(echo $cnt | tr -d ' ')

if [ $cnt -gt 0 ] ; then
   echo "To: xxxx AT airtouchpaging DOT net"                   >$xwork
#   echo "To: xxx AT xxx DOT org"                   >$xwork
  echo "Cc: xxx AT xxx DOT org"                                       >>$xwork
   echo "Subj: Cold Backup Error! There were $cnt files not copied. Please
manually copy.  " >>$xwork
   
   ssmtp -F "DBA Alert" -t <$xwork
fi

exit 0

# end of script

Any help will be appreciated.  I'm sure there is just a setting I've missed
somewhere.

Thanks!  

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019