Both sides previous revisionPrevious revisionNext revision | Previous revision |
util:smbutil [2012/03/03 21:27] – Copied from the sysop docs, added current command line options. echicken | util:smbutil [2022/04/03 03:53] (current) – [Syntax] Added V, D, u, L and U to match smbutil -h output nelgin |
---|
====== SMBUTIL ====== | ====== SMBUTIL - Message Base Utility ====== |
| |
The SMBUTIL can be used for several things, but most importantly, it must be used for maintaining your Synchronet message base (using the 'm' command). This command causes SMBUTIL to mark old messages, and messages over the maximum sub-board limit, as deleted so that their spaces can be used by 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 (using the 'p' command) periodically. The pack command causes SMBUTIL to compress the message bases removing any unused spaces (messages marked as deleted). | 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). |
| |
SMBUTIL maintenance and/or packing should be done using your daily event (or after importing from a network such as FidoNet). If your message base is 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 base is set up for the 'Self Packing' method, you do NOT need to use SMBUTIL to pack, only to perform maintenance. | 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 smbutil to 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 [[util: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===== | =====Usage===== |
| |
smbutil [/opts] cmd <filespec.SHD> | 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 ''[[dir:data]]/subs'' for sub-boards), unless: |
| - The message base files (e.g. '*.shd') are in the current working directory, or |
| - 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. |
| |
====cmd==== | |
<code> | <code> |
-l[n] list messages starting at number n | l[n] = list msgs starting at number n |
-r[n] read messages starting at number n | r[n] = read msgs starting at number n |
-x[n] dump message index at number n | x[n] = dump msg index at number n |
-v[n] view message headers starting at number n | v[n] = view msg headers starting at number n |
-i<f> import from text file f (or use stdin) | V[n] = view msg headers starting at number n verbose |
-e<f> import e-mail from text file f (or use stdin) | i[f] = import msg from text file f (or use stdin) |
-n<f> import netmail from text file f (r use stdin) | e[f] = import e-mail from text file f (or use stdin) |
-h dump hash file | n[f] = import netmail from text file f (or use stdin) |
-s display message base status | h = dump hash file |
-c change message base status | s = display msg base status |
-d delete all messages | c = change msg base status |
-m maintain message base - delete old messages and messages over max | R = re-initialize/repair SMB/status headers |
-p[k] pack message base (k specifies minimum packable Kbytes) | D = delete and remove all msgs (not reversable) |
| d = delete all msgs |
| u = undelete all msgs (remove delete flag) |
| m = maintain msg base - delete old msgs and msgs over max |
| p[k] = pack msg base (k specifies minimum packable Kbytes) |
| L = lock a msg base for exclusive-access/backup |
| U = unlock a msg base |
</code> | </code> |
| |
====opts==== | 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. |
<code> | <code> |
-c[m] create message base if it doesn't exist (m=max messages) | -c[m] = create message base if it doesn't exist (m=max msgs) |
-a always pack message base (disable compression analysis) | -a = always pack msg base (disable compression analysis) |
-i ignore dupes (do not store CRCs or search for duplicate hashes) | -i = ignore dupes (do not store CRCs or search for duplicate hashes) |
-d use default values (no prompt) for to, from, and subject | -d = use default values (no prompt) for to, from, and subject |
-l LZH-compress message text | -l = LZH-compress message text |
-o print errors on stdout (instead of stderr) | -o = print errors on stdout (instead of stderr) |
-p wait for keypress (pause) on exit | -p = wait for keypress (pause) on exit |
-! wait for keypress (pause) on error | -! = wait for keypress (pause) on error |
-b beep on error | -b = beep on error |
-t<s> set 'to' user name for imported message | -C = continue after some (normally fatal) error conditions |
-n<s> set 'to' netmail address for imported message | -t<s> = set 'to' user name for imported message |
-u<s> set 'to' user number for imported message | -n<s> = set 'to' netmail address for imported message |
-f<s> set 'from' user name for imported message | -u<s> = set 'to' user number for imported message |
-e<s> set 'from' user number for imported message | -f<s> = set 'from' user name for imported message |
-s<s> set 'subject' for imported message | -e<s> = set 'from' user number for imported message |
-z[n] set time zone (n=min +/- from UT or 'EST','EDT','CST',etc) | -s<s> = set 'subject' for imported message |
-# set number of messages to view/list (e.g. -1) | -z[n] = set time zone (n=min +/- from UT or 'EST','EDT','CST',etc) |
| -# = set number of messages to view/list (e.g. -1) |
</code> | </code> |
| |
====Examples==== | ====Examples==== |
| |
| === Maintenance === |
| |
for maintenance and packing (100k or more per sub): | for maintenance and packing (100k or more per sub): |
| |
SMBUTIL mp100 /sbbs/data/subs/*.shd | smbutil mp100 /sbbs/data/subs/*.shd |
| |
for maintenance only (self-packing sub-boards): | for maintenance only (self-packing sub-boards): |
| |
SMBUTIL m /sbbs/data/subs/*.shd | smbutil m /sbbs/data/subs/*.shd |
| |
WARNING: All BBS nodes should be DOWNed (offline) when using SMBUTIL with the pack option! To do this, set the SMBUTIL event to be 'Exclusive' in the SCFG program. | |
| |
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: | 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 | 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. ''[[util: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: |
| -continue upon error when opening a corrupted message base |
| -re-initialize the SMB/status headers of the message base |
| -change/configure the status header values (e.g. max messages, CRCs, age) |
| -display the status header |
| |
| After repairing a message base in this manner, you may still need to run ''[[util:fixsmb]]'' on it to resolve any remaining errors reported by ''[[util: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 ''[[module:postmsg]].js'' module (e.g. via [[util:JSexec]]). |
| |
The maintenance and pack commands are likely all that you will ever need to SMBUTIL for. | |
| |
===== See Also ===== | ===== See Also ===== |
* [[.:scfg:index|Utilities]] | * [[util:index|Utilities]] |
| * [[util:fixsmb]] |
| * [[util:chksmb]] |
| |
| {{tag>smb msgbase subs}} |