From 7d39c4e29b95f44a890d6aa63d76036f6b7a7e43 Mon Sep 17 00:00:00 2001 From: admins Date: Tue, 12 Jul 2022 19:22:47 -0400 Subject: updated some files that had drifted locally --- bin/rmuser | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'bin/rmuser') diff --git a/bin/rmuser b/bin/rmuser index db3ea38..98c697a 100755 --- a/bin/rmuser +++ b/bin/rmuser @@ -1,16 +1,17 @@ -#!/usr/local/bin/bash +#!/bin/sh +set -eu -# Hopefully, this never has to be used. -# Cleans up and removes a user from the system. -# gbmor +if [ -z "$1" ]; then + printf 'Please pass a user as the first argument.\n' + exit 1 +fi -echo "Removing user $1 from the system" -userdel $1 -echo "Cleaning /home and /var/www/users" -rm -rf /home/$1 -rm -rf /var/www/users/$1 -echo "Removing httpd config" -rm -f /etc/httpd/$1.conf -httpdpid=`pgrep httpd | awk 'NR==1{print $1}'` -kill -HUP $httpdpid -echo "Done! Don't forget to remove the appropriate include line from httpd-vusers.conf" +printf 'Removing user %s from the system\n' "$1" +userdel -r -v "$1" +printf 'Cleaning /var/www/users/%s\n' "$1" +rm -rf "/var/www/users/$1" +printf 'Deleting cgit repos\n' +rm -rf "/var/www/cgit_repos/$1" +printf 'Removing httpd config\n' +rm -f "/etc/httpd/$1.conf" +printf 'You need to remove the include line from httpd-vusers.conf and restart httpd\n' -- cgit 1.4.1-2-gfad0