Skip to content

Commit

Permalink
Update setup.sh file to skip if the user doesn't have root access
Browse files Browse the repository at this point in the history
* This change checks if current user has sudo access or not. If the
current user has sudo access then script is run as before and if
the current user doesn't have sudo access then skip the script.

* Run setup.sh file from Notebook with the change with and without root access
* With root access
```
The user has root access.
SageMaker instance route table setup is ok. We are good to go.
SageMaker instance routing for Docker is ok. We are good to go!
```

* Without root access
```
sudo: a password is required
The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!
```
  • Loading branch information
neelamgehlot committed Feb 14, 2019
1 parent 906427b commit a220fd7
Show file tree
Hide file tree
Showing 24 changed files with 192 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions hyperparameter_tuning/keras_bring_your_own/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions reinforcement_learning/rl_cartpole_coach/common/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions reinforcement_learning/rl_roboschool_ray/common/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/chainer_mnist/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/mxnet_gluon_cifar10/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/mxnet_gluon_mnist/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/mxnet_mnist/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/pytorch_cnn_cifar10/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions sagemaker-python-sdk/tensorflow_distributed_mnist/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

sudo -n true
if [ $? -eq 0 ]; then
echo "The user has root access."
else
echo "The user does not have root access. Everything required to run the notebook is already installed and setup. We are good to go!"
exit 0
fi

# Do we have GPU support?
nvidia-smi > /dev/null 2>&1
if [ $? -eq 0 ]; then
Expand Down

0 comments on commit a220fd7

Please sign in to comment.