add uninstaller

This commit is contained in:
ducoterra
2018-09-16 22:36:44 -04:00
parent 4e96fac5c6
commit 7e0f9f7d3c
2 changed files with 27 additions and 1 deletions

View File

@@ -296,4 +296,4 @@ if [ ! $user = "nginx" ] ; then
sed -i "s/user nginx/user $user nginx/" /etc/nginx/nginx.conf
fi
```
Which inserts the specified user (if not nginx) into nginx.conf.
Which inserts the specified user (if not nginx) into nginx.conf. The script finishes by enabling gunicorn and nginx at startup.

View File

@@ -0,0 +1,26 @@
# remove nginx conf
systemctl disable nginx
rm -f /etc/nginx/conf.d/$projectname.conf
# remove gunicorn
systemctl disable gunicorn
systemctl stop gunicorn
rm -f /etc/systemd/system/gunicorn.service
# remove project
rm -rf /home/$user/$projectname
# remove python
rm -rf $pyinstalldir
# remove yum dependencies
packages=(gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64)
for package in ${packages[@]};
do
echo -e "\tInstalling $package"
yum -y erase $package 1>> $yumlogloc 2>> $yumlogloc 3>> $yumlogloc
if [ $? -ne 0 ] ; then
echo -e "yum failed to remove $package. $yumlogmsg"
exit 1
fi
done