Ubuntu command ln -fs

31,029

man-page for ln would be a good start.

ln -fs [TARGET] [DIRECTORY]

Makes symbolic link between files. -f will "force" the link to be updated, if already exists.

Given the wording in your error message, I'm guessing /shared/config/monit/nginx doesn't exist, which is why the ln command fails.

Share:
31,029
japoowf
Author by

japoowf

Updated on July 09, 2022

Comments

  • japoowf
    japoowf almost 2 years

    on a mina-deploy script after install monit the script create a link with the monitored services like nginx etc.

    but before finish the install show this error, someone know what is

    ln -fs

    command on shell?

    -----> Setting up Monit... -----> Put monit/nginx.erb file to /shared/config/monit/nginx bash: line 82: /shared/config/monit/nginx: Is a directory $ sudo ln -fs "/shared/config/monit/nginx" "/" -----> FAILED

    the rest of the script

    namespace :monit do
    
      desc "Install Monit"
      task :install do
        invoke :sudo
        queue %{echo "-----> Installing Monit..."}
        queue "sudo apt-get -y install monit"
      end
    
      desc "Setup all Monit configuration"
      task :setup do
        invoke :sudo
        if monitored.any?
          queue %{echo "-----> Setting up Monit..."}
          monitored.each do |daemon|
            invoke :"monit:#{daemon}"
          end
          invoke :'monit:syntax'
          invoke :'monit:restart'
        else
          queue %{echo "-----> Skiping monit - nothing is set for monitoring..."}
        end
      end
    
    
      task(:nginx) { monit_config "nginx" }
      task(:postgresql) { monit_config "postgresql" }
      task(:redis) { monit_config "redis" }
      task(:memcached) { monit_config "memcached" }
      task(:private_pub) { monit_config "private_pub", "#{private_pub_name}" }
    
      %w[start stop restart syntax reload].each do |command|
        desc "Run Monit #{command} script"
        task command do
          invoke :sudo
          queue %{echo "-----> Monit #{command}"}
          queue "sudo service monit #{command}"
        end
      end
    end