Skip to content

Commit

Permalink
Fix Linux MSSQL Customize Examples
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Warfront1 committed Apr 18, 2022
1 parent 0e12922 commit e50d08e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Explicitly declare text files you want to always be normalized and converted to native line endings on checkout.
*.sh text eol=lf
2 changes: 1 addition & 1 deletion linux/preview/examples/mssql-customize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker build -t mssql-custom .

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

Note: MSSQL passwords must be at least 8 characters long, contain upper case, lower case and digits.
4 changes: 2 additions & 2 deletions linux/preview/examples/mssql-customize/configure-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ DBSTATUS=1
ERRCODE=1
i=0

while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do
while [[ $DBSTATUS -ne 0 || $ERRCODE -ne 0 ]] && [[ $i -lt 60 ]]; do
i=$i+1
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")
ERRCODE=$?
sleep 1
done

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

0 comments on commit e50d08e

Please sign in to comment.