delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/04/09:30:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 4 Mar 2005 09:28:30 -0500
From: Jason Tishler <jason AT tishler DOT net>
To: cygwin AT cygwin DOT com
Subject: Re: cron copy on network drives
Message-ID: <20050304142830.GA1432@tishler.net>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20050303161336 DOT 95612 DOT qmail AT web21202 DOT mail DOT yahoo DOT com>
Mime-Version: 1.0
In-Reply-To: <20050303161336.95612.qmail@web21202.mail.yahoo.com>
User-Agent: Mutt/1.4.1i
X-IsSubscribed: yes

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Paul,

On Thu, Mar 03, 2005 at 08:13:36AM -0800, Paul Hodor wrote:
> I am trying to set up a cron service to update some directories on a
> network drive, but I ran into a problem.
> 
> This copy command works from the command-line:
> cp -a -u -v //mydrive/myshare/dir1/* //mydrive/myshare/dir2 >> log 2>&1
> 
> However, if I run it with cron I get the following error:
> cp: cannot stat `//mydrive/myshare/dir1/*': No such file or directory
> 
> Do I need to use a different syntax for the path or am I doing
> something else wrong? I am running Windows XP Professional version 2002
> SP1 and cygwin DLL version 1.5.12.

The attached script, remount.sh, may help to solve your problem with a
few changes as appropriate:

    1. SSS
    2. DDD
    3. share

and if you are willing to store your Windows password in a file (i.e.,
~/.passwd).

I use remount.sh at work to remount a network share so I can backup my
local home directory (which is not otherwise backed up) to this share
(which is).

My crontab entry looks like the following:

    5 2 * * * remount.sh; backup.sh ...

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--ew6BAiZeqk4r7MaW
Content-Type: application/x-sh
Content-Disposition: attachment; filename="remount.sh"
Content-Transfer-Encoding: quoted-printable

#! /bin/bash

# $Id: remount.sh,v 1.3 2004/10/19 11:13:14 jtishler Exp $

tmp=3D/tmp/.$(basename $0).$$
passwd=3D$(<~/.passwd)
server=3D${server:-SSS}
domain=3D${domain:-DDD}
user=3D${user:-$LOGNAME}
share=3D"\\\\$server\\$user\$"

net use | fgrep -q "$share"
rc=3D$?
if [ $rc -eq 0 ]
then
	net use "$share" /delete >$tmp 2>&1
	rc=3D$?
	if [ $rc -ne 0 ]
	then
		cat $tmp
	fi
fi

net use "$share" "$passwd" "/user:$domain\\$user" >$tmp 2>&1
rc=3D$?
if [ $rc -ne 0 ]
then
	cat $tmp
fi

rm $tmp
exit $rc


--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--ew6BAiZeqk4r7MaW--

- Raw text -


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