Closed jbernal0019 closed 9 years ago
@jbernal0019 can you just tell me on which machine, as which user you tried to run it?
Also, do you remember when was the last time you used it successfully?
I did the typical process: ssh fnndsc@fnndsc sudo bash cd /neuro ... to where ./neuro-adduser.sh -u username -g gaab
I can't seem to remember when it worked properly last time <-(
@jbernal0019 thanks!
issue is there: https://github.com/FNNDSC/scripts/blob/master/neuro-adduser.sh#L132
@rudolphpienaar do you know on the top of your hear how to fix that? The sort -nk2 is ordering uids as below: 0 10000 10001 ... 9999
whereas we would like 10000 to appears after 9999.
I guess one soultion is to enforce the same number of decimals for each number..
[fnndsc@fnndsc:x86_64-Linux]~$>ldapsearch -b "dc=fnndsc" -D "cn=admin,dc=fnndsc" -W -h fnndsc | grep uidNumber | awk '{print $2 | "sort -nk2"}'
ldapsearch -b "dc=fnndsc" -D "cn=admin,dc=fnndsc" -W -h fnndsc | grep uidNumber | awk '{print $2 | "sort -n"}'
seems to work.
@rudolphpienaar do you know if -k2 is needed?
Hi Nico --
Sorry, only saw this now.
Yes, this what I would do:
ldapsearch -b "dc=fnndsc" -D "cn=admin,dc=fnndsc" -W -h fnndsc | grep uidNumber | awk '{print $2 | "sort -n -k 1"}'
for the sort:
-n : sort in numeric order -k 1 : sort on the data in key 1, i.e. the first column, which is actually superfluous since there is only one column.
The -k2 would sort on the second (non existent) column, so it defaults I think to a string sort on the only data it has. Just by pure blind luck this worked until now.
Source fixed and committed. Hopefully this will fix the script.
The script is assigning id 10000 to any newly created user.