Skip to content

Commit e50d08e

Browse files
committed
Fix Linux MSSQL Customize Examples
The Linux MSSQL Example had logic errors, as well as breaking (non-executing) code. In addition the README was updated to be platform agnostic (previously it did NOT work on windows). The gitattributes was added to ease with windows development and line endings on bash/shell scripts.
1 parent 0e12922 commit e50d08e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Explicitly declare text files you want to always be normalized and converted to native line endings on checkout.
2+
*.sh text eol=lf

linux/preview/examples/mssql-customize/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ docker build -t mssql-custom .
2424

2525
Then spin up a new container using `docker run`
2626
```
27-
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=StrongPassw0rd' -p 1433:1433 --name sql1 -d mssql-custom
27+
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=StrongPassw0rd" -p 1433:1433 --name sql1 -d mssql-custom
2828
```
2929

3030
Note: MSSQL passwords must be at least 8 characters long, contain upper case, lower case and digits.

linux/preview/examples/mssql-customize/configure-db.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ DBSTATUS=1
99
ERRCODE=1
1010
i=0
1111

12-
while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do
12+
while [[ $DBSTATUS -ne 0 || $ERRCODE -ne 0 ]] && [[ $i -lt 60 ]]; do
1313
i=$i+1
1414
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P $SA_PASSWORD -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases")
1515
ERRCODE=$?
1616
sleep 1
1717
done
1818

19-
if [ $DBSTATUS -ne 0 ] OR [ $ERRCODE -ne 0 ]; then
19+
if [[ $DBSTATUS -ne 0 ]] || [[ $ERRCODE -ne 0 ]]; then
2020
echo "SQL Server took more than 60 seconds to start up or one or more databases are not in an ONLINE state"
2121
exit 1
2222
fi

0 commit comments

Comments
 (0)