Fixed deluser.sh
This commit is contained in:
parent
e26387bb4c
commit
42b858105a
|
@ -1,7 +1,11 @@
|
|||
#!/bin/sh
|
||||
SLBRUSER=$1
|
||||
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||
grep -qvx "$SLBRUSER" users.txt && echo "user not found in users.txt, will not delete" && exit
|
||||
if !(grep -qx "$SLBRUSER" users.txt)
|
||||
then
|
||||
echo "user not found in users.txt, will not delete"
|
||||
exit
|
||||
fi
|
||||
|
||||
if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from listen.py
|
||||
then
|
||||
|
@ -13,5 +17,4 @@ lxc stop "$SLBRUSER"
|
|||
lxc delete "$SLBRUSER"
|
||||
sudo rm -rf "$SLBRUSER"
|
||||
sudo userdel "$SLBRUSER"
|
||||
tr '\n' ' ' < users.txt | sed "s/$SLBRUSER//g" | tr ' ' '\n' > users.temp
|
||||
mv users.temp users
|
||||
sed -ie "s/$SLBRUSER .*$//g"
|
||||
|
|
Loading…
Reference in New Issue