Files
squid-proxy-installer/squid-add-user.sh
2021-02-07 12:27:25 +05:30

54 lines
1.5 KiB
Bash

#!/bin/bash
############################################################
# Squid Proxy Installer
# Author: Yujin Boby
# Email: info@serverok.in
# Github: https://github.com/serverok/squid-proxy-installer/
# Web: https://serverok.in/squid
############################################################
# For paid support, contact
# https://serverok.in/contact
############################################################
if [ ! -f /usr/bin/htpasswd ]; then
echo "htpasswd not found"
exit 1
fi
read -e -p "Enter Proxy username: " proxy_username
if [ -f /etc/squid/passwd ]; then
/usr/bin/htpasswd /etc/squid/passwd $proxy_username
else
/usr/bin/htpasswd -c /etc/squid/passwd $proxy_username
fi
if [ ! -f /usr/local/bin/sok-find-os ]; then
echo "/usr/local/bin/sok-find-os not found"
exit 1
fi
SOK_OS=$(/usr/local/bin/sok-find-os)
if [ $SOK_OS == "ubuntu2004" ]; then
systemctl restart squid
elif [ $SOK_OS == "ubuntu1804" ]; then
systemctl restart squid
elif [ $SOK_OS == "ubuntu1604" ]; then
service squid restart
elif [ $SOK_OS == "ubuntu1404" ]; then
service squid3 restart
elif [ $SOK_OS == "debian8" ]; then
service squid3 restart
elif [ $SOK_OS == "debian9" ]; then
systemctl restart squid
elif [ $SOK_OS == "debian10" ]; then
systemctl restart squid
elif [ $SOK_OS == "centos7" ]; then
systemctl restart squid
else
echo "OS NOT SUPPORTED.\n"
echo "Contact admin@serverok.in to add support for your os."
exit 1;
fi