Skip to content
mrsenile edited this page May 19, 2024 · 1 revision

Backups

Backups are important for any service. RhostMUSH is not excluded. Due to crashing from acts of God, through power outages, failing disk, failing memory or other hardware, bugs that may show up in the RhostMUSH code, missing or changed system libraries or any number of other things, it's always posssible that database corruption can happen.

Because of this, it's entirely important that you establish some type of backup strategy.

Luckily, RhostMUSH provides some simple ways to do backups.

Mush In-Line dumps

To make dumps in the mush, you need to set up a process to dump the flatfiles for the systems.

The main mush database is done by the command: --- @dump/flat

The mail database is done by the command: --- wmail/unload

These flatfiles are dumped into your Server/game/data directory.

How the flatfiles are handled

There is, with the lauching of Startmush, a script called 'backup_flat.sh'. This will look for an existing flatfile called netrhost.db.flat (or netrhost can be replaced with what you may have changed your game name to be).

If it identifies this file, it will archive up this file along with the mail flatfiles and any sqlite databases (if specified) and make an archive and dump the compressed tarball into the Server/game/oldflat directory.

Any immediate flatfiles are moved to the Server/game/prevflat directory.

By default, this script keeps 7 consecutive backups. If you feel this is inadequate, you may increase that value to any number you wish, just be aware the larger the number, the more disk space it will consume.

Alternative ways to backup

signals

signal_cron

You may use signals to do backups if you want. There is a RhostMUSH config entry called signal_cron that if enabled allows you to send the SIGUSR1 signal (kill -USR1) to the mush pid proces.

This will pull in a cronfile from Server/game/cron that will be ran upon receiving the signal.

SIGHUP

The SIGHUP signal (kill -HUP) will force a flatfile dump of the mush. This is only the main database, and not the mail database.

API

You may utilize the API system to talk to the mush and integrate it with a unix cron or script or other method of your choosing. Please look at help entries on how to write API interfaces to RhostMUSH. There is example curl scripts to do so in the help files.

This option is an advanced feature.

backup_flat.sh standalone mode

The script has a '-s' option that you may pass to specify to run the script in stand-alone mode. This does a singular run and will not turn it into a daemon.

It is expected that if you choose to do this that you remove the daemon mode option from Startmush and stop the daemon process.