check if script is run as user root

This commit is contained in:
Yujin Boby
2021-02-18 13:46:06 +05:30
parent 2cfddcdaae
commit 42407ce4cd
3 changed files with 14 additions and 0 deletions

View File

@@ -10,6 +10,11 @@
# https://serverok.in/contact
############################################################
if [ `whoami` != root ]; then
echo "ERROR: You need to run the script as user root or add sudo before command."
exit 1
fi
if [ ! -f /usr/bin/htpasswd ]; then
echo "htpasswd not found"
exit 1

View File

@@ -10,6 +10,11 @@
# https://serverok.in/contact
############################################################
if [ `whoami` != root ]; then
echo "ERROR: You need to run the script as user root or add sudo before command."
exit 1
fi
if [ ! -f /usr/local/bin/sok-find-os ]; then
echo "/usr/local/bin/sok-find-os not found"
exit 1

View File

@@ -10,6 +10,10 @@
# https://serverok.in/contact
############################################################
if [ `whoami` != root ]; then
echo "ERROR: You need to run the script as user root or add sudo before command."
exit 1
fi
/usr/bin/wget --no-check-certificate -O /usr/local/bin/sok-find-os https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/sok-find-os.sh > /dev/null 2>&1
chmod 755 /usr/local/bin/sok-find-os