This is a mirror of the Friendica cleanup script by Ingo Jürgensmann. The original repository can be found at
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
ij 7b341ba084
Update ''
8 months ago
.DS_Store v0.4 "dry-run" release 2 years ago
.gitattributes Initial commit 3 years ago Update '' 8 months ago
cleanup_friendica.conf.sample add protectedusers 3 years ago sed changed to have it correct for grep 2 years ago


This is a small cleanup script for Friendica node admins to help with forgotten or dead accounts.

The script does two things:

  1. delete all users after a week that haven't logged in at all and didn't post anything (filter weeks and never.*never)
  2. search for accounts that haven't logged in for 6 months, send them a reminder mail and delete accounts that haven't logged within 7 months


  • save the script to your disk where your webserver user or the user running Friendica can access it (e.g. not under /root, maybe /usr/local/bin)
  • make the script executable (e.g. chown www-data:www-data /path/to/ && chmod ug+rx /path/to/
  • create a crontab to execute the script, e.g.: 16 9 2,15 * * /usr/local/bin/ to execute the script every two weeks
  • for the first 2 runs you should have the mail text the same and keep the deleting of the user commented out (line 54 in initial commit). After the first 2 runs you should change the first mail text to send out a mail that the account has been deleted because of inactivity and not reacting to the prior sent mails.
  • change the variables at the begin of the script to your site settings.


 --dry-run      : make a dry-run, no deletion will be done, no mails are sent.
 --dowhatimean  : add this option if you really want to delete users.

Other useful tips

  • the script expects the output of bin/console to be in LANG=en_US.UTF-8 or en
  • you can change the mail command from -b ${siteadmin} -- ${usermail} to -- ${siteadmin} and comment out all lines with bin/console user delete statement for testing runs
  • before putting this script into production you may want to inform your users via the notify_all addon of the upcoming changes/deletions.

Reference to Friendica issue

There is a feature request to render in Friendica Github issue tracker to deprecate this script.


If you want to support my work, you can donate via LiberaPay:

Donate via LiberaPay