Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Copy folder contents to another location on VPS

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 50 total)
  • Author
    Posts
  • #179546
    chrisburton
    Participant

    Hey, guys. Some of you may already know that I have Dropbox installed on my VPS. I am trying to get the contents inside a folder to sync to another location on my VPS.

    E.g.

    • Dropbox is installed in home/chrisburton/Dropbox/
    • Website content is in home/chrisburton/Dropbox/Website/

    I would like the contents inside /Website/ to go into var/www/html/ but watch home/chrisburton/Dropbox/Website/ for updates to any file and sync to var/www/html/ if there are any changes.

    Could someone help me with that?

    #179551
    nixnerd
    Participant

    Chris,
    I don’t use Dropbox but do you think there might be an OFFICIAL soltuion to this? Like one that is unique to Dropbox? What I’m saying is… do you think it’s a matter of getting the Dropbox settings correct? Or are you looking for anything that works?

    #179554
    James Burton
    Participant

    Hello Chris,

    What I think you could do is create a script to check the timestamp of the dropbox folder and if the number is higher than the timestamp in the website folder then copy the new files over to the website from dropbox.

    You can setup a script as a cron job every 6 hours to check the version.

    James

    #179560
    chrisburton
    Participant

    @Joe_Temp There’s this but I’m not sure what I’m doing.

    #179563
    nixnerd
    Participant

    Ohhhh nice! That’s exactly what you want. Let me read it for potential pitfalls. BTW… everything written in this article SHOULD work on your Mac. Let me check it out.

    #179565
    nixnerd
    Participant

    Hey Chris… what does it currently do now? When you put a file in home/chrisburton/Dropbox/Website/, where does it sync to?

    #179567
    Alen
    Participant

    There are two things you could do.

    Easiest is to change the Apache config and set the document root to that of DropBox/Website, so Apache will just serve it from there. No need to do anything else.

    Second. You could system link it. Basically make a shortcut that points to another location. In your case, you would need to remove the var/www/html folder first (obviously make sure you’re not deleting anything important inside). Then create a system link or shortcut named html that points to your DropBox folder.

    
    sudo rm -R /var/www/html
    sudo ln -s /var/www/html /home/chrisburton/Dropbox/Website/
    

    No need to setup CRON, since you’re making changes locally, upload to DropBox that is synced with the VPS making site reflect those updates automagically.

    #179569
    Alen
    Participant

    Stops the service

    
    $ dropbox stop
    

    Copy dropbox.bd that is inside ~/.dropbox/ folder, and rename it to dropbox.db.backup

    
    $ cp ~/.dropbox/dropbox.db dropbox.db.backup
    

    Download Python Script

    
    $ wget http://dl.dropbox.com/u/119154/permalink/dropboxdir.py
    

    Make script executable

    
    $ chmod +x dropboxdir.py
    

    Move the folder to location of your choice /foo/bar

    
    $ mv ~/Dropbox /foo/bar
    

    Run the Downloaded Script with --setfolder flag

    
    $ ./dropboxdir --setfolder=/foo/bar
    

    Start the service back up

    
    $ dropbox start
    
    #179571
    nixnerd
    Participant

    @alenabdula Just out of curiosity… since I don’t use Dropbox:

    What directory is the link Chris posted talking about? The target (to be watched) directory? Or the sync directory? It seemed like it was really only talking about moving one directory and that’s what I didn’t understand.

    #179572
    nixnerd
    Participant

    What directory is the link Chris posted talking about? The target (to be watched) directory? Or the sync directory? It seemed like it was really only talking about moving one directory and that’s what I didn’t understand.

    Aaaaand you just answered that. Sync directory.

    #179578
    Alen
    Participant

    Chris I wouldn’t change the actual location of the Dropbox folder. Use the Apache document root or system link. If you’re only doing this because you wish to serve your site from Dropbox.

    #179579
    chrisburton
    Participant

    @AlenAbdula

    dropbox stop
    

    All I get is unrecognized service or command not found

    #179583
    Alen
    Participant

    Can you run sudo /sbin/service dropbox stop

    #179585
    chrisburton
    Participant
    dropbox: unrecognized service
    
    #179589
    Alen
    Participant

    What about ~/.dropbox-dist/dropboxd stop.

    How did you initially start the service when you installed it?

Viewing 15 posts - 1 through 15 (of 50 total)
  • The forum ‘Other’ is closed to new topics and replies.