Compare Directory to Master Directory, Symlink Dupe Files

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I have multiple sites all running the same script. Currently each site has its' own copy of the script in its' directory. There are a few files for each site that are modified specifically for that site.

I need a BASH script that will compare the files in a directory to the files in a master directory, if the files do not differ the script needs to quickly delete the file and replace it with a symlink to the copy that's in the master directory.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

Handy little piece of information about PHP related to this subject.

$_SERVER['SCRIPT_FILENAME'] should work just fine in place of dirname(__FILE__) or __DIR__ when symlinks are involved.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I still haven't gotten around to writing anything myself. While setting up a new site to use symlinks by default I've run in to little bugs here and there so I've been a little leery about letting a script loose on the server that might create a mass-downage. :)

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 168 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.