mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-27 14:03:25 +00:00
When running lsf_startup [root@xcat-mn lsf]# updatenode $lsf_master --scripts lsf_startup <...> p8r1n1: Mon Nov 30 21:30:58 EST 2015 Running postscript: lsf_startup p8r1n1: INFO: Run hostsetup on each node. p8r1n1: ./lsf_startup: line 48: /usr/share/lsf//install/hostsetup: No such file or directory <...> It is because this expression is broken; no mention to / as field separator. # grep '^LSF_VERSION' /install/postscripts/lsf_startup LSF_VERSION=`find /$LSF_TOP -name hostsetup|head -1|awk '{print $5}'` See: [root@p8r1n1 ~]# LSF_TOP="/usr/share/lsf" [root@p8r1n1 ~]# find /$LSF_TOP -name hostsetup | head -1 //usr/share/lsf/9.1/install/hostsetup [root@p8r1n1 ~]# find /$LSF_TOP -name hostsetup|head -1|awk '{print $5}' [root@p8r1n1 ~]# Additionally, it would fail if the version was not exactly the 5th field, which may occur if the user doesn't use /usr/share/lsf for LSF_TOP. And there's even a leading / before $LSF_TOP (ie, /$LSF_TOP).. and what if the user sets LSF_TOP with a trailing / ? So, lets make this independent of leading slashes and trailing slashes. LSF_VERSION="$(find /$LSF_TOP -path "*/install/hostsetup" | grep -o "/[^/]\+/install/hostsetup" | cut -d/ -f2)" It works on the usual and non-usual cases: [root@p8r1n1 ~]# LSF_TOP=/usr/share/lsf [root@p8r1n1 ~]# find /$LSF_TOP -path '*/install/hostsetup' | grep -o '/[^/]\+/install/hostsetup' | cut -d/ -f2 9.1 [root@p8r1n1 ~]# LSF_TOP=/test/some/other/dir/for/lsf [root@p8r1n1 ~]# mkdir -p $LSF_TOP/9.1/install [root@p8r1n1 ~]# touch $LSF_TOP/9.1/install/hostsetup [root@p8r1n1 ~]# find /$LSF_TOP -path "*/install/hostsetup" | grep -o '/[^/]\+/install/hostsetup' | cut -d/ -f2 9.1
xCAT - eXtreme Cloud Administration Toolkit xCAT is a toolkit for the deployment and administration of clusters. xCAT documentation is available at: http://xcat-docs.readthedocs.org/en/latest/ xCAT is made available as open source software under the EPL license: http://www.opensource.org/licenses/eclipse-1.0.php Developers and prospective contributors are encouraged to read the developers guide: http://xcat-docs.readthedocs.org/en/latest/developers/ and in particular the github related subsection: http://xcat-docs.readthedocs.org/en/latest/developers/github/
Languages
Perl
78.6%
Shell
11.3%
JavaScript
7.1%
Python
1.8%
PHP
0.4%
Other
0.4%