-
Notifications
You must be signed in to change notification settings - Fork 9
Added script files #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7b89ae8
Added script files
mahimab1 4e187e5
Updated the reference of script folder to staging branch
mahimab1 8f4c635
Corrected script links
mahimab1 785f585
Updated new VNet healthcheck from master to staging branch
mahimab1 8b673e3
Altered the range of testing
mahimab1 329b8a1
Reverted back healthchecks from staging to master
mahimab1 1bc5fb3
Reverted back template links from staging to master
mahimab1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
WORKSPACE=/opt/mathworks | ||
|
||
# $0 is the file name | ||
|
||
storageAccountName="$1" | ||
dbConnectionString="$2" | ||
mpsEndpoint="$3" | ||
CIDRRange="$4" | ||
cloudPlatform="$5" | ||
osPlatform="$6" | ||
ikey="$7" | ||
resourceGroup="$8" | ||
subscriptionID="$9" | ||
userName="${10}" | ||
passWord="${11}" | ||
redisName="${12}" | ||
gatewayPrivateIP="${13}" | ||
offerType="${14}" | ||
|
||
azEnvironment=$(sudo curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq -r '.compute.azEnvironment') | ||
|
||
echo "$storageAccountName" | ||
echo "$dbConnectionString" | ||
echo "$mpsEndpoint" | ||
echo "$CIDRRange" | ||
echo "$cloudPlatform" | ||
echo "$osPlatform" | ||
echo "$ikey" | ||
echo "$resourceGroup" | ||
echo "$subscriptionID" | ||
echo "$userName" | ||
echo "$redisName" | ||
echo "$gatewayPrivateIP" | ||
echo "$offerType" | ||
echo "$azEnvironment" | ||
|
||
JSONCMD=' | ||
{ | ||
"storageAccountName": "'"$storageAccountName"'", | ||
"dbConnectionString": "'"$dbConnectionString"'", | ||
"mpsEndPoint": "'"$mpsEndpoint"'", | ||
"CIDRRange": "'"$CIDRRange"'", | ||
"cloudPlatform": "'"$cloudPlatform"'", | ||
"osPlatform": "'"$osPlatform"'", | ||
"ikey": "'"$ikey"'", | ||
"resourceGroup": "'"$resourceGroup"'", | ||
"subscriptionID": "'"$subscriptionID"'", | ||
"redisCacheName": "'"$redisName"'", | ||
"gatewayPrivateIP": "'"$gatewayPrivateIP"'", | ||
"offerType": "'"$offerType"'", | ||
"azEnvironment": "'"$azEnvironment"'" | ||
} | ||
' | ||
|
||
destination=$WORKSPACE/controller/dynamicOptions.json | ||
rm $destination | ||
|
||
echo $JSONCMD >> $destination | ||
|
||
echo "Written Config File successfully" | ||
|
||
cd $WORKSPACE/cloud/main | ||
node $WORKSPACE/cloud/main/server/hash_pw.js "${userName}" "${passWord}" "${passWord}" | ||
|
||
echo "Written sudo passwd successfully" | ||
|
||
cp ./.shadow ./bin/. | ||
|
||
echo "Copied shadow file" | ||
|
||
systemctl restart refarchcontroller | ||
|
||
echo "Restarted daemon successfully!" | ||
|
||
|
||
# chown to this user /opt/mathworks | ||
# Clear history | ||
history -c | ||
|
||
echo "Cleared History!" | ||
# File Location | ||
#https://mwstorage24.blob.core.windows.net/azuretemplates/initVm.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<# | ||
.SYNOPSIS | ||
This Script runs on MPS instances | ||
#> | ||
|
||
# Param ( | ||
# [Parameter(Mandatory=$False)][string]$SERVER_MODE | ||
# ) | ||
|
||
# disable automatic updates | ||
Echo "disabling automatic updates" | ||
$service = Get-WmiObject Win32_Service -Filter 'Name="wuauserv"' | ||
if ($service) | ||
{ | ||
if ($service.StartMode -ne "Disabled") | ||
{ | ||
$result = $service.ChangeStartMode("Disabled").ReturnValue | ||
if($result) | ||
{ | ||
Echo "Failed to disable the 'wuauserv' service. The return value was $result." | ||
} | ||
else {Echo "Success to disable the 'wuauserv' service."} | ||
|
||
if ($service.State -eq "Running") | ||
{ | ||
$result = $service.StopService().ReturnValue | ||
if ($result) | ||
{ | ||
Echo "Failed to stop the 'wuauserv' service. The return value was $result." | ||
} | ||
else {Echo "Success to stop the 'wuauserv' service."} | ||
} | ||
} | ||
else {Echo "The 'wuauserv' service is already disabled."} | ||
} | ||
else {Echo "Failed to retrieve the service 'wuauserv'."} | ||
|
||
#Disable Automatic Windows Updates | ||
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name AUOptions -Value 1 | ||
|
||
# exclude .ctf file from windows defender scanning | ||
#Add-MpPreference -ExclusionExtension ".ctf" | ||
|
||
#Get-ChildItem "C:\Program Files\MATLAB\MATLAB Runtime\" -Directory | | ||
# ForEach-Object { | ||
# Echo ($_.FullName + '\bin\win64\extractCTF.exe') | ||
# Add-MpPreference -ExclusionProcess ($_.FullName + '\bin\win64\extractCTF.exe') | ||
# } | ||
|
||
Stop-Service -Name Spooler -Force | ||
|
||
Set-Service -Name Spooler -StartupType Disabled | ||
|
||
# Execute reboot required for domain join | ||
#Restart-Computer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/bash | ||
#Put your extra commands here | ||
ls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/bash | ||
|
||
WORKSPACE=/opt/mathworks | ||
|
||
LOG_DIR=/var/log/custom_script | ||
LOG_FILE=$LOG_DIR/custom_script.log | ||
|
||
# Create log directory and file | ||
sudo mkdir -p $LOG_DIR | ||
sudo touch $LOG_FILE | ||
sudo chmod 666 $LOG_FILE | ||
|
||
# $0 is the file name | ||
|
||
storageAccountName="$1" | ||
dbConnectionString="$2" | ||
mpsEndpoint="$3" | ||
CIDRRange="$4" | ||
cloudPlatform="$5" | ||
osPlatform="$6" | ||
ikey="$7" | ||
resourceGroup="$8" | ||
subscriptionID="$9" | ||
userName="${10}" | ||
passWord="${11}" | ||
redisName="${12}" | ||
gatewayPrivateIP="${13}" | ||
offerType="${14}" | ||
|
||
azEnvironment=$(sudo curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq -r '.compute.azEnvironment') | ||
|
||
echo "$storageAccountName" | ||
echo "$dbConnectionString" | ||
echo "$mpsEndpoint" | ||
echo "$CIDRRange" | ||
echo "$cloudPlatform" | ||
echo "$osPlatform" | ||
echo "$ikey" | ||
echo "$resourceGroup" | ||
echo "$subscriptionID" | ||
echo "$userName" | ||
echo "$redisName" | ||
echo "$gatewayPrivateIP" | ||
echo "$offerType" | ||
echo "$azEnvironment" | ||
|
||
JSONCMD=' | ||
{ | ||
"storageAccountName": "'"$storageAccountName"'", | ||
"dbConnectionString": "'"$dbConnectionString"'", | ||
"mpsEndPoint": "'"$mpsEndpoint"'", | ||
"CIDRRange": "'"$CIDRRange"'", | ||
"cloudPlatform": "'"$cloudPlatform"'", | ||
"osPlatform": "'"$osPlatform"'", | ||
"ikey": "'"$ikey"'", | ||
"resourceGroup": "'"$resourceGroup"'", | ||
"subscriptionID": "'"$subscriptionID"'", | ||
"redisCacheName": "'"$redisName"'", | ||
"gatewayPrivateIP": "'"$gatewayPrivateIP"'", | ||
"offerType": "'"$offerType"'", | ||
"azEnvironment": "'"$azEnvironment"'" | ||
} | ||
' | ||
|
||
destination=$WORKSPACE/controller/dynamicOptions.json | ||
rm $destination | ||
|
||
echo $JSONCMD >> $destination | ||
|
||
echo "Written Config File successfully" | ||
|
||
cd $WORKSPACE/cloud/main | ||
node $WORKSPACE/cloud/main/server/hash_pw.js "${userName}" "${passWord}" "${passWord}" | ||
|
||
echo "Written sudo passwd successfully" | ||
|
||
cp ./.shadow ./bin/. | ||
|
||
echo "Copied shadow file" | ||
|
||
# Update package lists and log errors | ||
sudo apt-get update 2>> $LOG_FILE | ||
if [ $? -ne 0 ]; then | ||
echo "apt update failed. Check the log file at $LOG_FILE" | tee -a $LOG_FILE | ||
fi | ||
|
||
# Install openssh-server and log errors | ||
sudo apt-get install -y openssh-server 2>> $LOG_FILE | ||
if [ $? -ne 0 ]; then | ||
echo "apt install failed. Check the log file at $LOG_FILE" | tee -a $LOG_FILE | ||
fi | ||
|
||
systemctl restart refarchcontroller | ||
|
||
echo "Restarted daemon successfully!" | ||
|
||
|
||
# chown to this user /opt/mathworks | ||
# Clear history | ||
history -c | ||
|
||
echo "Cleared History!" | ||
# File Location | ||
#https://mwstorage24.blob.core.windows.net/azuretemplates/initVm.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<# | ||
.SYNOPSIS | ||
This Script runs on MPS instances | ||
#> | ||
|
||
# Param ( | ||
# [Parameter(Mandatory=$False)][string]$SERVER_MODE | ||
# ) | ||
|
||
# disable automatic updates | ||
Echo "disabling automatic updates" | ||
$service = Get-WmiObject Win32_Service -Filter 'Name="wuauserv"' | ||
if ($service) | ||
{ | ||
if ($service.StartMode -ne "Disabled") | ||
{ | ||
$result = $service.ChangeStartMode("Disabled").ReturnValue | ||
if($result) | ||
{ | ||
Echo "Failed to disable the 'wuauserv' service. The return value was $result." | ||
} | ||
else {Echo "Success to disable the 'wuauserv' service."} | ||
|
||
if ($service.State -eq "Running") | ||
{ | ||
$result = $service.StopService().ReturnValue | ||
if ($result) | ||
{ | ||
Echo "Failed to stop the 'wuauserv' service. The return value was $result." | ||
} | ||
else {Echo "Success to stop the 'wuauserv' service."} | ||
} | ||
} | ||
else {Echo "The 'wuauserv' service is already disabled."} | ||
} | ||
else {Echo "Failed to retrieve the service 'wuauserv'."} | ||
|
||
#Disable Automatic Windows Updates | ||
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name AUOptions -Value 1 | ||
|
||
# exclude .ctf file from windows defender scanning | ||
#Add-MpPreference -ExclusionExtension ".ctf" | ||
|
||
#Get-ChildItem "C:\Program Files\MATLAB\MATLAB Runtime\" -Directory | | ||
# ForEach-Object { | ||
# Echo ($_.FullName + '\bin\win64\extractCTF.exe') | ||
# Add-MpPreference -ExclusionProcess ($_.FullName + '\bin\win64\extractCTF.exe') | ||
# } | ||
|
||
Stop-Service -Name Spooler -Force | ||
|
||
Set-Service -Name Spooler -StartupType Disabled | ||
|
||
# Execute reboot required for domain join | ||
#Restart-Computer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#! /bin/bash | ||
#Put your extra commands here | ||
LOG_DIR=/var/log/custom_script | ||
LOG_FILE=$LOG_DIR/custom_script.log | ||
|
||
# Create log directory and file | ||
sudo mkdir -p $LOG_DIR | ||
sudo touch $LOG_FILE | ||
sudo chmod 666 $LOG_FILE | ||
|
||
# Update package lists and log errors | ||
sudo apt-get update 2>> $LOG_FILE | ||
if [ $? -ne 0 ]; then | ||
echo "apt update failed. Check the log file at $LOG_FILE" | tee -a $LOG_FILE | ||
fi | ||
|
||
# Install openssh-server and log errors | ||
sudo apt-get install -y openssh-server 2>> $LOG_FILE | ||
if [ $? -ne 0 ]; then | ||
echo "apt install failed. Check the log file at $LOG_FILE" | tee -a $LOG_FILE | ||
fi | ||
|
||
ls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.