Skip to content

Instantly share code, notes, and snippets.

@jurandysoares
Created July 25, 2024 22:19
Show Gist options
  • Save jurandysoares/c04c66b4bf973a24d58a25d9ba9b90e5 to your computer and use it in GitHub Desktop.
Save jurandysoares/c04c66b4bf973a24d58a25d9ba9b90e5 to your computer and use it in GitHub Desktop.
#!/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