diff --git a/README.md b/README.md index ff84ab7..9769855 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +Which inserts the specified user (if not nginx) into nginx.conf. The script finishes by enabling gunicorn and nginx at startup. \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh index e69de29..d681e2a 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -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 \ No newline at end of file