Skip to content

Instantly share code, notes, and snippets.

@jeancsanchez
Created December 6, 2019 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeancsanchez/01896cf526013a72848d6c269c3f3397 to your computer and use it in GitHub Desktop.
Save jeancsanchez/01896cf526013a72848d6c269c3f3397 to your computer and use it in GitHub Desktop.
Exemplo de script de inicialização do sistema Debian.
#!/bin/bash
### BEGIN INIT INFO
# Provides: start_apis
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start das apis
# Description: Blah
### END INIT INFO
case "$1" in
start)
echo "Inicializando últimos containers ativos..."
containers=$(cat /root/deploy/apis)
docker start $containers
;;
stop)
echo "By containers :("
;;
*)
echo "Usage: /etc/init.d/start_apis {start}"
exit 1
;;
esac
exit 0
@jeancsanchez
Copy link
Author

jeancsanchez commented Dec 6, 2019

Colocar esse arquivo no diretório /etc/init.d/
chmod 755 /etc/init.d/meuscript
Sudo update-rc.d meuscript defaults
Sudo update-rc.d meuscript enable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment