Skip to content

Instantly share code, notes, and snippets.

@piotrmaslanka
Created April 12, 2023 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotrmaslanka/afcb490fae4bf2f98394378eb4b50377 to your computer and use it in GitHub Desktop.
Save piotrmaslanka/afcb490fae4bf2f98394378eb4b50377 to your computer and use it in GitHub Desktop.
antivir-psql.sh
#!/bin/bash
#
# After noticing a bunch of weird psql processes running on my server I decided all of them needed to die.
# This is what this script is for.
# Just put the following line (without the "# " at the beginning) into your crontab, this process in /usr/bin/antivir-psql.sh.
# and make it executable only for the owner (readable for the owner as well). If you want to disable the conditional disable, just remove
# the lines starting with if and fi. If you want to disable the antivirus for some time, just drop a /antivir-disabled file. Remember
# to edit it out when you're gone. And there goes the fabulous crontab line:
#
# * * * * * root /usr/bin/antivir-psql.sh
if [ ! -a "/antivir-disabled" ]; then
kill -9 `ps aux | grep psql | cut -d" " -f 6` ;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment