Skip to content

Commit

Permalink
kamctl: usrloc command to delete older expired records from database …
Browse files Browse the repository at this point in the history
…table

- kamctl ul dbclean [<secs>]
- if secs parameter is not given, the value 3600 is used
  • Loading branch information
miconda committed Jun 14, 2019
1 parent a54b36e commit 955e8a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/kamctl/kamctl
Original file line number Diff line number Diff line change
Expand Up @@ -2717,6 +2717,18 @@ usrloc() {
fi
;;

dbclean)
require_dbengine
KSR_CLEAN_VAL=3600
if [ $# -eq 2 ] ; then
KSR_CLEAN_VAL=$2
fi
QUERY="delete from $USRLOC_TABLE where expires < SUBDATE(NOW(), INTERVAL $KSR_CLEAN_VAL SECOND);"
$DBCMD "$QUERY"

exit $?
;;

*)
usage_usrloc
exit 1
Expand Down
1 change: 1 addition & 0 deletions utils/kamctl/kamctl.ctlbase
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cat <<EOF
ul add <username> <uri> ............... introduce a permanent usrloc entry
ul add <username> <uri> <expires> ..... introduce a temporary usrloc entry
ul add <user> <uri> <expires> <path> .. introduce a temporary usrloc entry
ul dbclean [<secs>].................... remove older expired records from db table
EOF
}
USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_usrloc"
Expand Down

0 comments on commit 955e8a5

Please sign in to comment.