Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to cp some files from my Sun

Status
Not open for further replies.

agape234

Programmer
Oct 10, 2001
128
US
I need to cp some files from my Sun box to a W2K server on a routine basis.
What would the best approach be to do this.
Cron?FTP from the W2K on a schedule?
Any tips or cautions?
 
Look into SAMBA. This makes your Sun machine look like an NT server to your Windows machine. This means you could even leave the file on the Sun and have it on a SAMBA share that your W2K machine accesses as if was another W2K machine. You could use a [tt]copy[/tt] command on the W2K machine to bring the file over.

Go to for more info.
 
Here's a script I use to send files to a remote PC
integer N_FILES_COPIED
integer N_FILES_TOSEND
RETRY_INTERVAL=30
SCRIPT=ftp.script
COPY_SCRIPT=copy.script
IP_ADDR=100.100.10.100
RUSER=anonymous
RPASS=passwd
echo "machine ${IP_ADDR}
login ${RUSER}
password ${RPASS}
" > ${HOME}/.netrc
chmod 600 ${HOME}/.netrc

cd /data
COPY_LOG=/data/copy.log

trap "rm -f ${SCRIPT} ; stty echo ; exit" 1 2 3 4 5 6 15

ADDR=${IP_ADDR}

if [ -r /home//ran.today ]
then
true
else
echo " TX HAS NOT RUN - OR HAS ALREADY BEEN COPIED (`date`)" >> ${_COPY_LOG}
echo "${0} ${*}" | at now + ${RETRY_INTERVAL} minutes
exit 99
fi

if ping -c1 -i2 ${ADDR} >/dev/null 2>&1
then
true
else
echo "NO RESPONSE FROM ${ADDR} @ `date`" >> ${_COPY_LOG}
echo "${0} ${*}" | at now + ${RETRY_INTERVAL} minutes
exit 99
fi

#Using file listing all ftp commands needed
cat ${COPY_SCRIPT} > ${SCRIPT}

# Now call ftp to transfer files...

ftp -i -v ${ADDR} < ${SCRIPT} >/data/ftp.out 2>&1

N_FILES_COPIED=$(grep -c &quot;226 Transfer complete.&quot; /data/ftp.out)
N_FILES_TOSEND=$(grep -c &quot;put &quot; ${COPY_SCRIPT})

if [ $N_FILES_COPIED -eq $N_FILES_TOSEND ]
then
rm -f ${SCRIPT}
rm -f /home//ran.today
echo &quot;File COPIED TO ${ADDR} @ `date`&quot; >> ${_COPY_LOG}
touch /home/.copied
exit 0
else
echo &quot; COPY FAILED TO ${ADDR} @ `date`&quot; >> ${_COPY_LOG}
echo &quot;${0} ${*}&quot; | at now + ${RETRY_INTERVAL} minutes
fi


the file called copy.script contains ftp instructions ie

cd /common/int
put /data/prints/pwdin pwadin.doc
bye

HTH Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top