Ubuntu Question

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
I'm a college student, and I didn't want to bring my big huge desktop rig to school, just my laptop. I run Ubuntu on my desktop, and I SSH into it to build kernels/ROM's. Until now, I copy files from it to my laptop with SCP, but I would like to automatically upload the finished files to my FTP. Can someone teach me how to write a script to automatically upload the files, or write it for me? Thanks.
 
  • Like
Reactions: BlueStarEnt

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
I'm a college student, and I didn't want to bring my big huge desktop rig to school, just my laptop. I run Ubuntu on my desktop, and I SSH into it to build kernels/ROM's. Until now, I copy files from it to my laptop with SCP, but I would like to automatically upload the finished files to my FTP. Can someone teach me how to write a script to automatically upload the files, or write it for me? Thanks.
I'm sure someone knows how, anyone?
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Actually... I just sftpd home...


You will need to modify this for your setup.. this was from Andromeda3 nightly.
Code:
Put your build code here




DISPLAY=:0
export DISPLAY

x=`expect -c 'set timeout 3600' -c 'spawn sftp [email protected]; 
           sleep 10; 
           expect "s password:"; send "password\n"; 
           expect "Connected to"; 
           expect "sftp>"; send "cd Andromeda/nightly\n";
           expect "sftp>"; send "put /home/adam/TeamKomin/Distributions/Andromeda-Nightly-'"$date"'.zip\n"; 
           expect "sftp>"; send "cd ..\n"; 
           expect "sftp>"; send "rm ./AndromedaNightly.zip\n"; 
           expect "sftp>"; send "symlink nightly/Andromeda-Nightly-'"$date"'.zip ./AndromedaNightly.zip\n"; 
           expect "sftp>"; send "ls\n"; 
           expect "sftp>"; send "quit\n"'`

if [ $? != 0 ]; then
  echo "`date` $x" >> ~/Desktop/error.log
  zenity --info --text="Nightly Build Failed
$x" 200 200
else
  zenity --info --text="Nightly Build Sucessful
$x" 200 200  
fi
 

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
Actually... I just sftpd home...


You will need to modify this for your setup.. this was from Andromeda3 nightly.
Code:
Put your build code here




DISPLAY=:0
export DISPLAY

x=`expect -c 'set timeout 3600' -c 'spawn sftp [email protected]; 
           sleep 10; 
           expect "s password:"; send "password\n"; 
           expect "Connected to"; 
           expect "sftp>"; send "cd Andromeda/nightly\n";
           expect "sftp>"; send "put /home/adam/TeamKomin/Distributions/Andromeda-Nightly-'"$date"'.zip\n"; 
           expect "sftp>"; send "cd ..\n"; 
           expect "sftp>"; send "rm ./AndromedaNightly.zip\n"; 
           expect "sftp>"; send "symlink nightly/Andromeda-Nightly-'"$date"'.zip ./AndromedaNightly.zip\n"; 
           expect "sftp>"; send "ls\n"; 
           expect "sftp>"; send "quit\n"'`

if [ $? != 0 ]; then
  echo "`date` $x" >> ~/Desktop/error.log
  zenity --info --text="Nightly Build Failed
$x" 200 200
else
  zenity --info --text="Nightly Build Sucessful
$x" 200 200  
fi
Ok; awesome. Here's what I was using:
Code:
#!/bin/bash

Build script stuff here

# Configure FTP server settings
HOST="androtransfer.com"
USER="username"
PASSWD="password"

FILE=$RELEASE

echo "Uploading to server"
ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
put $FILE /public_html/captivate/$FILE
EOT

echo "Finished at $(zdump EST)"
 

BlueStarEnt

Member
Mar 11, 2011
34
4
0
I'm a college student, and I didn't want to bring my big huge desktop rig to school, just my laptop. I run Ubuntu on my desktop, and I SSH into it to build kernels/ROM's. Until now, I copy files from it to my laptop with SCP, but I would like to automatically upload the finished files to my FTP. Can someone teach me how to write a script to automatically upload the files, or write it for me? Thanks.

Dropbox is a service that does the same thing that you are asking. I think they hand out two gigabytes of free space and all your connected computers are
updated with the uploaded information without much fuss.
 

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
Dropbox is a service that does the same thing that you are asking. I think they hand out two gigabytes of free space and all your connected computers are
updated with the uploaded information without much fuss.
Yeah, but that's just one more thing I have to deal with. Also, these builds go out to testers, and I would rather give them an FTP then make them make their own dropbox and share the folder with them. Handing out a link is infinitely more simple and quick. I have a box.net account that would do that, but not for my testers.
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Dropbox is a service that does the same thing that you are asking. I think they hand out two gigabytes of free space and all your connected computers are
updated with the uploaded information without much fuss.
Ubuntu One is another one... however he is looking to automate FTP service. Dropbox is kiddie stuff. Its not a pro way to distribute files.
 
  • Like
Reactions: BlueStarEnt