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

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
util:smbutil [2010/02/24 15:35] – created digitalmanutil:smbutil [2022/04/03 03:53] (current) – [Syntax] Added V, D, u, L and U to match smbutil -h output nelgin
Line 1: Line 1:
-====== SMBUTIL ======+====== SMBUTIL - 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 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===== 
 + 
 +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. 
 + 
 +<code> 
 +       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 
 +       V[n] = view msg headers starting at number n verbose 
 +       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) 
 +          = dump hash file 
 +          = display msg base status 
 +          = change msg base status 
 +          = re-initialize/repair SMB/status headers 
 +          = delete and remove all msgs (not reversable) 
 +          = delete all msgs 
 +          = undelete all msgs (remove delete flag) 
 +          = maintain msg base - delete old msgs and msgs over max 
 +       p[k] = pack msg base (k specifies minimum packable Kbytes) 
 +          = lock a msg base for exclusive-access/backup 
 +          = unlock a msg base 
 +</code> 
 + 
 +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> 
 +      -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) 
 +</code> 
 + 
 +====Examples==== 
 + 
 +=== Maintenance === 
 + 
 +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. ''[[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]]).
  
-FIXME 
  
 ===== See Also ===== ===== See Also =====
-  * [[:util:|Utilities]]+  * [[util:index|Utilities]] 
 +  * [[util:fixsmb]] 
 +  * [[util:chksmb]] 
 + 
 +{{tag>smb msgbase subs}}