title: ubuntu FTP script - hetzner
body: <p>Hie all
  I am trying to backup of my application directory, database backup and then sending it to my ftp server at hetzner by using the following script and i get few errors</p>
  
  <p>my server details: ubuntu12-04 (in hetzner)
  database: postgresql8.4
  my ftp server: hetzner
  Trying to take backup at ubuntu12.04 server and copying in ftp my server
  got a sample script at following <a href="http://ubuntuforums.org/showthread.php?t=229943" rel="nofollow">link</a></p>
  
  <p>bakupscript.sh</p>
  
  <pre><code>site=ftp://u***.your-backup.de
  username=u***
  passwd=*******************
  backupdir=/opt/openbravo-erp
  filenameob="openbravo-erp.tar.gz"
  
  echo "Creating a ob backup file $filenameob of $backupdir."
  
  # Make a tar gzipped backup file
  tar -cvzf /home/hetznerftp/"$filenameob" "$backupdir"
  
  echo "creating a db backup file $filenamedb of ob database."
  export PGPASSWORD="*my db password*"
  backup_dir="/home/manideep/hetzner/"
  #String to append to the name of the backup files
  pg_dump -h localhost -U tad openbravo -Fc $i &gt; $backup_dir$i\rajedb.backup
  
  #login into ftp server
  ftp -in &lt;&lt;EOF
  open $ftp_site
  user $username $passwd
  bin
  put /home/manideep/hetzner$filenameob 
  put /home/manideep/hetznerftp/pgdump.backup
  close 
  bye
  EOF
  </code></pre>
  
  <p>When i try executing that script through command <code>./backupscript.sh</code></p>
  
  <p>i get following error</p>
  
  <pre><code>Creating a backup file openbravo-erp.tar.gz of /opt/openbravo-erp.
  creating a db backup file  of ob database.
  (to) usage: open host-name [port]
  Not connected.
  Not connected.
  Not connected.
  Not connected.
  </code></pre>
  
  <p>How do i send those files through script? </p>
  
  <p>and Will this replace the existing files while i use command <code>put</code> in <code>ftp</code> in <code>ftp server</code>
  if not how do i do it? thankyou</p>