.netrc and a here document to automate and script FTP

Using a .netrc file combined with a “Here Document” for ftp scripting can simplify ftp scripting by automating the login and setting up macros – that can be run from a scripted ftp session

Here is an example .netrc file from something I did recently. ┬áNote do a “chmod 600 .netrc” after you have created the file to give it the correct file permissions to be used.

  • the first line specifies a machine name that can be automatically logged into

.netrc

machine myhostname login remoteusername password remotepassword

Now here is the “Here Document” contained in the bash script testf.bash that does most of the work.

testf.bash

dtstr=$(date +%Y_%m_%d); export dtstr
cd /u01/app/oracle/fast_recovery_area/PROD/backupset/$dtstr
echo “date is: “$dtstr
ftp -v rh2 <<EOFMark
ls
mkdir $dtstr
cd $dtstr
prompt
mput *
quit
EOFMark

Advertisements

SQL Developer on Mac OS Creates large log file on startup

After installing SQL Developer 3.2 on Mac OS 10.8.2 my disk space started running out. And kept running out. SQL Developer was constantly appending to a log file in /tmp

I traced the problem to the startup .sh script for sql developer.

/Applications/SQLDeveloper.app/Contents/MacOS/sqldeveloper.sh
bash ./sqldeveloper >/tmp/sqldeveloper-startup-`uuidgen`.log

I stopped sql developer from creating the ┬álog file and that fixed the problem, plus, sqldeveloper starts up faster, probably runs faster etc. So, if you don’t want this logging going on… just change the command to:

bash ./sqldeveloper

Not sure how this logging got put in place (maybe it was an install gone wrong?) and got out of control… but I learned how to stop it.