0
Fork 0
mirror of https://github.com/netweak/agent.git synced 2025-01-13 22:40:28 -05:00

Update install.sh

This commit is contained in:
Lucas Decrock 2024-11-03 05:16:43 +01:00
parent f57cc08ad8
commit 7806aa2420

View file

@ -171,20 +171,17 @@ if [ -z "$(ps -Al | grep cron | grep -v grep)" ]; then
fi
fi
# Change to temp directory
cd /tmp || cd /
# Attempt to delete previous agent
if [ -f "/etc/$NETWEAK/agent.sh" ]; then
# Remove cron entry and user
if id -u "$NETWEAK" >/dev/null 2>&1; then
(crontab -u "$NETWEAK" -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u "$NETWEAK" - && userdel "$NETWEAK"
else
(crontab -u root -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u root -
fi
# Then remove the directory
rm -Rf "/etc/$NETWEAK"
# Remove agent dir
rm -Rf "/etc/$NETWEAK"
# Remove cron entry and user
if id -u "$NETWEAK" > /dev/null 2>&1; then
(crontab -u "$NETWEAK" -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u "$NETWEAK" - && userdel "$NETWEAK"
else
(crontab -u root -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u root -
fi
fi
# Create agent dir