Add missing fasdb cleanup sessions cron job.
This commit is contained in:
parent
66b8df00ac
commit
28b402ded1
3 changed files with 36 additions and 0 deletions
12
roles/postgresql_server/files/fasdb-cleanup-sessions
Executable file
12
roles/postgresql_server/files/fasdb-cleanup-sessions
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
PGOPTIONS='-c maintenance_work_mem=1048576'
|
||||
SESSIONDBS='fas2'
|
||||
|
||||
# Clean out old sessions since TurboGears doesn't
|
||||
for db in $SESSIONDBS; do
|
||||
/usr/bin/psql $db > /dev/null <<EOF
|
||||
delete from visit where expiry < now() - interval '1h';
|
||||
delete from visit_identity where visit_key not in (select visit_key from visit);
|
||||
EOF
|
||||
done
|
|
@ -0,0 +1,6 @@
|
|||
SHELL=/bin/bash
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root@fedoraproject.org
|
||||
HOME=/
|
||||
|
||||
*/10 * * * * postgres /usr/local/bin/fasdb-cleanup-sessions
|
|
@ -88,3 +88,21 @@
|
|||
tags:
|
||||
- cron
|
||||
- postgresql
|
||||
|
||||
- name: Set up a script for cron job to clean long fas sessions on fas database server only
|
||||
copy: >
|
||||
src=fasdb-cleanup-sessions
|
||||
dest=/usr/local/bin/fasdb-cleanup-sessions
|
||||
when: inventory_hostname.startswith('db-fas01')
|
||||
tags:
|
||||
- cron
|
||||
- postgresql
|
||||
|
||||
- name: Set up a cron job to clean long fas sessions on fas database server only
|
||||
copy: >
|
||||
src=fasdb-cleanup-sessions.cron
|
||||
dest=/etc/cron.d/fasdb-cleanup-sessions.cron
|
||||
when: inventory_hostname.startswith('db-fas01')
|
||||
tags:
|
||||
- cron
|
||||
- postgresql
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue