views:

578

answers:

1

I've this capistrano command.

  task :symlink_shared do
        run "rm -rf  #{current_path}/config/database.yml"
        run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
        run "rm -rf  #{current_path}/config/app_config.yml"
        run "ln -nfs #{shared_path}/config/app_config.yml #{release_path}/config/app_config.yml"

        run "rm -rf  #{current_path}/public/records"
        run "ln -nsf #{shared_path}/uploads/records #{release_path}/public/records"
        run "rm -rf  #{current_path}/public/documents"
        run "ln -nsf #{shared_path}/uploads/documents #{release_path}/public/documents"
        run "rm -rf  #{current_path}/public/pdf_xmls"
        run "ln -nsf #{shared_path}/uploads/pdf_xmls #{release_path}/public/pdf_xmls"
        run "rm -rf  #{current_path}/public/pdf_xml_files"
        run "ln -nsf #{shared_path}/uploads/pdf_xml_files #{release_path}/public/pdf_xml_files"
    end

Everything works and the symlinks are also created. But the last command symlink creates the symlink pdf_xml_files one step inside. i.e. it creates a directory named pdf_xml_files and inside it, the pdf_xml_files symlink is created. Need some help??

+1  A: 

It looks like the /home/deploy/weddingcards/releases/20090325105337/public/pdf_xml_files directory already exists.

The ln command is finding that directory and forcing it to create a symlink to your target inside the directory.

If you remove /home/deploy/weddingcards/releases/20090325105337/public/pdf_xml_files then run the same command it should do what you want it to.

Alternately you could change the command to:

run "ln -nsf #{shared_path}/uploads/pdf_xml_files #{release_path}/public/"

and it will create the symlink inside the public directory.

Andy
I'll check this and reply later.
Millisami