bash Ubuntu 命令 ln -fs
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41970263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu command ln -fs
提问by japoowf
on a mina-deploy script after install monit the script create a link with the monitored services like nginx etc.
在安装 monit 后的 mina-deploy 脚本上,该脚本创建一个与受监控服务(如 nginx 等)的链接。
but before finish the install show this error, someone know what is
但在完成安装之前显示此错误,有人知道是什么
ln -fs
ln -fs
command on shell?
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
-----> 设置Monit... -----> 将monit/nginx.erb 文件放到/shared/config/monit/nginx bash: line 82: /shared/config/monit/nginx: Is a目录 $ sudo ln -fs "/shared/config/monit/nginx" "/" -----> 失败
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
回答by pbuck
man-page for ln
would be a good start.
手册页ln
将是一个好的开始。
ln -fs [TARGET] [DIRECTORY]
Makes symbolic link between files. -f
will "force" the link to be updated, if already exists.
在文件之间建立符号链接。-f
将“强制”更新链接(如果已存在)。
Given the wording in your error message, I'm guessing /shared/config/monit/nginx
doesn't exist, which is why the ln
command fails.
鉴于您的错误消息中的措辞,我猜/shared/config/monit/nginx
不存在,这就是ln
命令失败的原因。