0

I want to set up a task that will destroy all inactive persistent chat rooms on my eJabberd server. Is it possible to set up such a task?

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
Lasonic
  • 841
  • 2
  • 9
  • 28

2 Answers2

2

ejabberdctl command-line tool can give you MUC administration commands access when the module mod_muc_admin is enabled in ejabberd. That module is available as default since ejabberd 15.04.

Once enabled, you should have access to several commands to destroy MUC rooms:

  • destroy_room to destroy a specific MUC room
  • destroy_rooms_file to destroy a list of MUC rooms.
  • rooms_unused_destroy to destroy all MUC rooms that have not been used in N days.

The list of commands is available in ejabberd documentation: Multi User Chat Administration Commands.

You will be probably using the command rooms_unused_destroy, as it seems to do exactly what you need.

Regarding the scheduling of the task, you should rely on your Operating System scheduling tool, for example cron. You should be careful and test your command manually during several days before automating it, to avoid any mistake.

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
  • Thanks for the response. Do you know by any chance how to enable mod_muc_admin on Unbuntu? As soon as I add {mod_muc_admin, []}, to my Modules and restart my .cfg it breaks the server. I'm running ejabberd 2.1.11 on the server. – Lasonic Aug 05 '15 at 15:23
  • As mentioned: "That module is available as default since ejabberd 15.04.". You need to install ejabberd 15.04 and up. It will not work on ejabberd 2.1 so you need to install ejabberd yourself to use that module. – Mickaël Rémond Aug 05 '15 at 15:25
  • You cannot. You need to use newer ejabberd. – Mickaël Rémond Aug 05 '15 at 16:41
  • Well in that case, could you point me in the right direction on install eJabberd 15.04 on an Ubuntu server? – Lasonic Aug 05 '15 at 16:43
  • Documentation is here: http://docs.ejabberd.im/admin/guide/installation/ with all options: Binary installer, experimental deb package and compilation from source code. Download page is: http://www.process-one.net/en/ejabberd/downloads/ – Mickaël Rémond Aug 05 '15 at 16:58
0

You could create a cron job on the server if it is running linux to kill all the chat rooms. I don't know what the command would be for ejabbered, but a line for something like the below. If you wanted it to run once a day.

  1 1 * * * service ejabberd restart

Minute
Hour
Days
Weeks
Months

HSchmale
  • 1,838
  • 2
  • 21
  • 48