Skip to content

Instantly share code, notes, and snippets.

View olegbuevich's full-sized avatar

Aleh Buyevich olegbuevich

View GitHub Profile
@olegbuevich
olegbuevich / postgres
Last active September 29, 2016 20:36 — forked from mmrwoods/postgres
Postgres maintenance crontab file
# dump all databases once every 24 hours
45 4 * * * root nice -n 19 su - postgres -c "pg_dumpall --clean" | gzip -9 > /var/local/backup/postgres/postgres_all.sql.gz
# vacuum all databases every night (full vacuum on Sunday night, lazy vacuum every other night)
45 3 * * 0 root nice -n 19 su - postgres -c "vacuumdb --all --full --analyze"
45 3 * * 1-6 root nice -n 19 su - postgres -c "vacuumdb --all --analyze --quiet"
# re-index all databases once a week
0 3 * * 0 root nice -n 19 su - postgres -c 'psql -t -c "select datname from pg_database order by datname;" | xargs -n 1 -I"{}" -- psql -U postgres {} -c "reindex database \"{}\";"'
@olegbuevich
olegbuevich / passenger@.service
Created October 1, 2018 12:30 — forked from ejangi/passenger@.service
systemd file for standalone passenger apps
[Unit]
Description=Passenger Standalone Application Server
After=network.target
[Service]
Type=forking
PrivateTmp=yes
User=nginx
Group=nginx
WorkingDirectory=/srv/www/%i
@olegbuevich
olegbuevich / audit.rules
Created February 13, 2021 23:43 — forked from Neo23x0/audit.rules
Linux Auditd Best Practice Configuration
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/