Schedule Clear all session

  • Used Zammad version: 3.6
  • Used Zammad installation source: package
  • Operating system: Ubuntu 20.04
  • Browser + version: any

Requesting for your kind assistance how can I set to clear all session. Example is every sunday
or
How can I manually clear all session via command.

Thank You and God Bless

There is a rake command you could run;
rake db:sessions:clear #Clear the sessions table
or maybe less intrusive;
rake db:sessions:trim # Trim old sessions from the table (default: > 30 days)
Maybe schedule this using cron. not sure if it can also be done via the scheduler. Also i would expect old sessions would be cleaned automatically, but i’m not sure it’s happening, at least not for me.

1 Like

thank you very much sir…

God Bless and More power

Hey, this works really well.

Do you know where I can set the session time that is taken into account with the trim command?

So sessions older than 24h should be deleted e.g. :slight_smile:

For Ubuntu you can set in cron I think.

I understand the cron, how do I change the 30 days in the db:trim command itself?

It doesn’t help if the cron runs every 24 hours but only deletes sessions older than 30 days.

see; activerecord-session_store/database.rake at master · rails/activerecord-session_store · GitHub
you should be able to set an environment variable SESSION_DAYS_TRIM_THRESHOLD and set it to 1
to clear the last 24 hours

1 Like