Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

This is an old revision of the document!


Table of Contents

smbutil - Synchronet Message Base Utility

The Synchronet Message Base Utility (smbutil) can be used for several things, but most importantly, it must be used for maintaining the message bases of your system's public message areas (sub-boards).

The m command (for maintenance) instructs smbutil to mark old messages, and messages over the maximum sub-board limit, as deleted so that the disk space used by these message can be allocated to new messages. If you are using the 'Hyper Allocation' or 'Fast Allocation' method for your message bases, you must also use this utility to pack your message bases periodically. The pack (p) command instructs smbutilto compress the message bases, removing any unused allocation blocks (for messages marked as deleted).

smbutil maintenance and/or packing should be done using an exclusive daily timed event (configured in SCFG->External Programs->Timed Events). If your message bases are using the 'Fast Allocation' or 'Hyper Allocation' storage methods, you should run maintenance before packing (there is no reason to pack if you do not run maintenance!). If your message bases are configured for the 'Self Packing' method, you do NOT need to use smbutil to pack, only to perform maintenance.

Note: The mail base (the Synchronet message base for e-mail and all forms of netmail storage) is maintained nightly by the Synchronet Terminal Server. You should not normally need to use smbutil on your mail base.

Usage

smbutil operates on message base files only. It does not read Synchronet configuration files so therefore will not automatically know where to find the message base files (i.e. by default in data/subs for sub-boards), unless:

  1. The message base files (e.g. '*.shd') are in the current working directory, or
  2. You specify the full path to the message base file(s) on the SMBUTIL command-line

WARNING: All BBS nodes should be offline when using smbutil with the pack command! To do this, set the smbutil event to be 'Exclusive' in the SCFG program.

Syntax

smbutil [-opt] [-opt] cmd [cmd] <filespec.shd>

Commands

One or more commands (cmd values) may be specified per invocation of smbutil.

       l[n] = list msgs starting at number n
       r[n] = read msgs starting at number n
       x[n] = dump msg index at number n
       v[n] = view msg headers starting at number n
       i[f] = import msg from text file f (or use stdin)
       e[f] = import e-mail from text file f (or use stdin)
       n[f] = import netmail from text file f (or use stdin)
       h    = dump hash file
       s    = display msg base status
       c    = change msg base status
       R    = re-initialize/repair SMB/status headers
       d    = delete all msgs
       m    = maintain msg base - delete old msgs and msgs over max
       p[k] = pack msg base (k specifies minimum packable Kbytes)

Commands without values may be concatenated (e.g. mp is the equivalent of m p).

Options

Zero or more options (opts) may be specified per invocation of smbutil.

      -c[m] = create message base if it doesn't exist (m=max msgs)
      -a    = always pack msg base (disable compression analysis)
      -i    = ignore dupes (do not store CRCs or search for duplicate hashes)
      -d    = use default values (no prompt) for to, from, and subject
      -l    = LZH-compress message text
      -o    = print errors on stdout (instead of stderr)
      -p    = wait for keypress (pause) on exit
      -!    = wait for keypress (pause) on error
      -b    = beep on error
      -C    = continue after some (normally fatal) error conditions
      -t<s> = set 'to' user name for imported message
      -n<s> = set 'to' netmail address for imported message
      -u<s> = set 'to' user number for imported message
      -f<s> = set 'from' user name for imported message
      -e<s> = set 'from' user number for imported message
      -s<s> = set 'subject' for imported message
      -z[n] = set time zone (n=min +/- from UT or 'EST','EDT','CST',etc)
      -#    = set number of messages to view/list (e.g. -1)

Examples

Mainteance

for maintenance and packing (100k or more per sub):

smbutil mp100 /sbbs/data/subs/*.shd

for maintenance only (self-packing sub-boards):

smbutil m /sbbs/data/subs/*.shd

When using the pack command, smbutil will check to see if it is necessary for you to pack your message base, if you want to skip this checking and have it unconditionally pack the message base (useful when attempting to repair a corrupted message base), you should add the '-a' switch to the command line:

smbutil -a p /sbbs/data/subs/*.shd

The maintenance and pack commands are likely all that you will ever need to use smbutil for.

Repair

If you have a message base that is severely corrupted (e.g. fixsmb cannot open it for index repair), you can use the following smbutil command-line to re-initialize the message base status header:

smbutil -C Rcs /sbbs/data/subs/badbase

This command will instruct smbutil to:

  1. continue upon error hen opening a corrupted message base
  2. re-initialize the SMB/status headers of the message base
  3. change/configure the status header values (e.g. max messages, CRCs, age)
  4. display the status header

After repairing a message base in this manner, you may still need to run fixsmb on it to resolve any remaining errors reported by chksmb.

Auto-post

smbutil may be used for automated message posting (or email sending), by using the i command (or e command for e-mail), for example:

smbutil -d i/path/to/msg.txt /sbbs/data/subs/subcode

You can override the default to/from/subject header field values by using the various command-line options (e.g. -t, -f, -s). But note: when using a value that contains spaces (multiple words), you will need to enclose the option and value in quotes:

smbutil -tAll "-fYour Sysop" "-sDaily Bulletin" i/path/to/msg.txt /sbbs/data/subs/subcode

Note: Although message importing/auto-posting via smbutil is supported, the preferred solution is to use the postmsg.js module (e.g. via JSexec).

See Also