[ADD] script to delete production

- prod documentation
This commit is contained in:
Mathieu Benoit 2020-07-31 15:21:54 -04:00
parent e280814aa9
commit a2ba60dff3
2 changed files with 34 additions and 0 deletions

View file

@ -63,3 +63,9 @@ Simply update all feature.
```bash
./run.sh --limit-time-real 99999 --stop-after-init -u all -d DATABASE
```
# Delete an instance in production
Caution, this delete home of users, it's irrevocable.
```bash
./script/delete_production.sh
```

28
script/delete_production.sh Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
. ./env_var.sh
echo -e "\n==== Delete user ===="
echo -n "Are You Sure to delete user ${EL_HOME}? [Y/n]"
old_stty_cfg=$(stty -g)
stty raw -echo
answer=$( while ! head -c 1 | grep -i '[ny]' ;do true ;done )
stty $old_stty_cfg
if echo "$answer" | grep -iq "^y" ;then
echo "Remove all system of ${EL_HOME}"
else
echo "Cancel..."
exit 1
fi
sudo systemctl stop ${EL_CONFIG}.service
# Disable daemon
sudo systemctl disable ${EL_CONFIG}.service
sudo rm -f /etc/systemd/system/${EL_CONFIG}.service
# Disable nginx
sudo rm -rf ${EL_HOME}
sudo rm -f /etc/nginx/sites-available/${EL_WEBSITE_NAME}
sudo rm -f /etc/nginx/sites-enabled/${EL_WEBSITE_NAME}
sudo systemctl restart nginx