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??

4

1 に答える 1

2

/home/deploy/weddingcards/releases/20090325105337/public/pdf_xml_files ディレクトリが既に存在するようです。

ln コマンドはそのディレクトリを見つけて、ディレクトリ内にターゲットへのシンボリック リンクを強制的に作成します。

/home/deploy/weddingcards/releases/20090325105337/public/pdf_xml_files を削除すると、同じコマンドを実行すると、必要なことが実行されます。

または、コマンドを次のように変更できます。

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

public ディレクトリ内にシンボリックリンクが作成されます。

于 2009-04-02T08:37:54.683 に答える