用于创建虚拟集群的Bash脚本不起作用

时间:2017-06-28 18:26:37

标签: linux bash centos7

我正在尝试创建一个脚本来在我的虚拟机上创建虚拟集群,这是一个CentOS 7 minimal。

我有一个名为GridPane

的脚本
@ECHO OFF 
Runs my Python Scripts

C:\path-to-python\Python.exe C:\path-to-scripts\A.py
ECHO Ran script A

(Repeat as needed)

PAUSE

然后据我所知,我必须让它可执行 cluster

在此之后我应该为它创建一个syslink #!/bin/bash function vc { echo echo -n "Enter project name: " read platform_name echo echo -n "web extension: " read web_extension echo echo -e "The following website will be created" echo -e "\e[32m Platform:\e[0m\t${platform_name}" echo -e "\e[32m Extension:\e[0m\t${web_extension}" echo -e "\e[32m Full URL:\e[0m\t http://www.${platform_name}.${web_extension}" echo echo -e "Do you wish to proceed? [Y/n]" read -p "Are you sure? " -n 1 -r echo # (optional) move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo echo -e "\e[32m Creating platform \e[0m\t" else echo echo -e "\e[32m Not creating platform \e[0m\t" fi } if [ -n "$(type -t $FUNCTION_NAME)" ] && [ "$(type -t $FUNCTION_NAME)" = function ]; then $FUNCTION_NAME $2; else help; fi 现在我通常应该只在终端中打字chmod +x cluster并且它应该执行脚本但是它一直给我"命令集群找不到"

我做错了什么吗?或者我是否需要在其上使用另一个chmod以便我可以运行它?

1 个答案:

答案 0 :(得分:1)

符号链接目标相对于符号链接位置进行解析。在您的情况下,这意味着,如果您运行/ bin / cluster,它会在/ bin /目录中查找名为cluster(目标)的文件。提供指向文件的相对路径或链接到绝对路径:ln -s / path / to / cluster / bin / cluster。 还要确保执行符号链接的任何人都可以读取和执行目标位置。