s4
changeset 688:1aa16edc28e5
Partial Committing Starts:
For session-DB separation, prepare session db file.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 18 May 2020 19:07:52 +0900 |
parents | 19d28bbdbee8 |
children | 13fb1392d2f2 |
files | s4-funcs.sh |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/s4-funcs.sh Mon May 18 17:41:51 2020 +0900 1.2 +++ b/s4-funcs.sh Mon May 18 19:07:52 2020 +0900 1.3 @@ -16,6 +16,8 @@ 1.4 querylog=${QUERYLOG:-$tmpdir/query.log} 1.5 searchlog=${SEARCHLOG:-$tmpdir/search.log} 1.6 workdb=$dbdir/tmpdata.sq3 1.7 +sessdb=$dbdir/sess.sq3 1.8 +sesstb=tmp.sess 1.9 listentlimit=${LISTENTLIMIT:-30} 1.10 admin=${ADMIN:-hostmaster@example.org} 1.11 noreply=${NOREPLY:-noreply@example.org} 1.12 @@ -371,6 +373,16 @@ 1.13 exec 5> $sqi # Turning $sqi access through fd5 for continuous open state 1.14 chmod o-r $tmpdir/error.out $tmpdir/debug.out 1.15 rm $sqi 1.16 + # Attach supplemental DB 1.17 + cat >&5 <<-EOF 1.18 + .output /dev/null 1.19 + ATTACH DATABASE "$sessdb" AS tmp; 1.20 + SELECT * FROM $sesstb; 1.21 + CREATE TABLE IF NOT EXISTS $sesstb(user, skey, expire, UNIQUE(user, skey)); 1.22 + DELETE FROM $sesstb WHERE expire < datetime('now', 'localtime'); 1.23 + DELETE FROM $sesstb WHERE expire is NULL or expire = ''; 1.24 + .output stdout 1.25 + EOF 1.26 } 1.27 cleanup2() { # Dirty workaround for produced zombie processes 1.28 if [ -n "$HTTP_USER_AGENT" ]; then # When called from httpd