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