Closed m0rfeo closed 2 years ago
@m0rfeo At the first run of the project, the slurmdbd
must create a new database on the MariaDB server. and we cannot start slurmdbd
it the database isn't ready yet.
The part of the script you mentioned ensures that the database already exists. If it doesn't, then the script goes to sleep for five seconds and repeats the existence check.
It may look weird a bit but it's simple.
c
and only one row with the value either 0
or 1
.-H
parameter of the mysql
command allows returning the query result as HTML, like <TABLE BORDER=1><TR><TH>c</TH></TR><TR><TD>1</TD></TR></TABLE>
0
or 1
from the output presented above so I am using the sed with the regular expression that cuts all unnecessary characters off.I am open to suggestions about how to make this part more elegant :)
@hackprime I undestand why you need to do that and i think that is a correct solution don't affect to the integrity and don't create security holes.
But i still dont undestand what you wan't to get with this part sed -E 's/c|<[^>]+>//g>.
Thanks for support and congratulations for your proyect.
@m0rfeo sed -E 's/c|<[^>]+>//g'
removes unnecessary text from the output of the mysql
command using the regular expression as a pattern. In other words, having the following output
<TABLE BORDER=1><TR><TH>c</TH></TR><TR><TD>0</TD></TR></TABLE>
it removes all HTML tags (the <[^>]+>
part of the regular expression) and the c
character (the c
part) from the passed string. So, the output of the sed
will be:
0
@hackprime Thanks for the explanation!
Hello, in docker-entrypoint.sh to init slurm db the script exec this line:
IS_DATABASE_EXIST="`mysql -h $MARIADB_HOST -u root -p"$MARIADB_ROOT_PASSWORD" -qfsBe "select count(*) as c from information_schema.schemata where schema_name='$MARIADB_DATABASE'" -H | sed -E 's/c|<[^>]+>//g>
What are happening on this part?
select count(*) as c from information_schema.schemata where schema_name='$MARIADB_DATABASE'" -H | sed -E 's/c|<[^>]+>//g>