Created
July 25, 2024 22:19
-
-
Save jurandysoares/c04c66b4bf973a24d58a25d9ba9b90e5 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# sudo meu-vps | |
# Conteúdo de: /etc/sudoers.d/asa | |
# %asa ALL=(ALL) NOPASSWD: /usr/local/bin/meu-vps | |
if [[ -v SUDO_USER ]]; then | |
CONT_NAME="vps-${SUDO_USER}" | |
status_cont=$(lxc info "${CONT_NAME}" | /bin/grep -E ^Status: | awk '{print $2}') | |
if [ "${status_cont}" != "RUNNING" ]; then | |
lxc start "${CONT_NAME}" | |
fi | |
echo "${CONT_NAME}" | figlet | /usr/games/lolcat | |
lxc exec "${CONT_NAME}" bash | |
lxc stop "${CONT_NAME}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment