Created
December 18, 2015 21:18
-
-
Save martinrusev/45a420e9e3d791610b05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # kill all of the user processes | |
| ps -u amonagent | grep -v PID | awk '{print $1}' | xargs -i kill {} | |
| sleep 2 | |
| ps -u amonagent | grep -v PID | awk '{print $1}' | xargs -i kill {} | |
| # Systemd | |
| if which systemctl > /dev/null 2>&1 ; then | |
| systemctl stop amonagent | |
| # Sysv | |
| else | |
| service amonagent stop | |
| fi | |
| # Systemd | |
| if which systemctl > /dev/null 2>&1 ; then | |
| systemctl disable amonagent | |
| # Sysv | |
| else | |
| # update-rc.d sysv service: | |
| if which update-rc.d > /dev/null 2>&1 ; then | |
| update-rc.d -f amonagent remove | |
| update-rc.d amonagent stop | |
| # CentOS-style sysv: | |
| else | |
| chkconfig --del amonagent | |
| fi | |
| fi | |
| getent passwd amonagent >/dev/null && userdel amonagent | |
| getent group amonagent >/dev/null && groupdel amonagent | |
| # Remove config | |
| rm -rf /etc/opt/amonagent | |
| # Remove binary | |
| rm -rf /opt/amonagent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment