====== Semaphore Files ======

Synchronet supports a variety of semaphore files which can be used to externally-trigger internal-operations of the various servers and services.

The //contents// of semaphore files are not relevant; the mere existence or updated date/time stamp of the file is enough to trigger the coresponding operation.

Semaphore files can be created or their date/time stamp updated with simple command-line operations. For example:

on Windows:
  C:\>echo. > \sbbs\data\dothing.now

on UNIX:
  $ touch /sbbs/data/dothing.now
  

===== Existence Semaphore Files =====

Existence semaphore files just need to be merely created to trigger the corresponding operation and the semaphore file will be automatically deleted:

==== Sysop Available for Chat ====
If the file ''[[dir:ctrl]]/sysavail.chat'' exists, then the sysop availability for chat with users can be indicated and users will be allowed to page the local sysop to chat.
==== Event Semaphore Files ====

Events that have been configured in [[util:SCFG]]->External Programs->Timed Events can be externally triggered by creating the file ''[[dir:data]]///<event>//.now'', where ''//<event>//'' is the "Internal Code" of the corresponding timed event. Events are executed (serially, by default) by the [[server:terminal|Terminal Server]] //Event Thread//.

Example (forcing execution of the FidoNet import event):

  $ touch /sbbs/data/fidoin.now
  
==== QWK Pack Semaphore Files ====

QWK message packets can be created for specific user accounts by creating the file ''[[dir:data]]/pack//<user>//.now'' where ''//<user>//'' is the number of the user account to to create the packet for.  

Example (forcing the creation of a QWK packet for user #1):

  $ touch /sbbs/data/pack0001.now
  
QWK packets are created in the ''[[dir:data]]/file'' directory with a filename of ''//<user>//.qwk''. If a QWK packet already exists for the user, it will be opened and appended with any new messages.

==== QWK Pre-pack Semaphore File ====

The QWK pre-pack event (which runs automatically once a day) can be forced by creating the file ''[[dir:data]]/prepack.now''.

==== QWKnet Call-out Semaphore File ====

QWK Network hub call-out events can be forced to execute by creating the file ''[[dir:data]]/qnet///<hub-id>//.qwk'', where ''//<hub-id//'' is the QWK-ID of the QWKnet Hub configured in [[util:SCFG]]->Networks->QWK.

Example (forcing QWK call-out to QWKnet hub //VERT//):

  $ touch /sbbs/data/qnet/vert.now
  
==== QWKnet Timed-event Semaphore Files ====
After receiving and processing a QWKnet ''.QWK'' or ''.REP'' file, Synchronet will //touch// the ''[[dir:data]]/**qnet-qwk**.now'' or ''[[dir:data]]/**qnet-rep**.now'' files to trigger timed events of those names, if they exist, to execute.

==== Pause Server Semaphore File ====
The existence of the file ''[[dir:ctrl]]/pause'' (or a supported service/host variant) will cause that server to stop accepting incoming client connections. Any existing clients/connections will continued to be service while the server is paused. Removing the file will "resume" the server.
===== Timestamp Semaphore Files =====

Timestamp semaphore files are not deleted when the operation is triggered, so the date/time stamp of the file must be updated (i.e. the file must be "touched") to trigger the operation again:

On a multi-host BBS, the servers and services on a specific host can be signaled by "touching" the file ''[[dir:ctrl]]/<semfile>.//<hostname>//'' or ''[[dir:ctrl]]/<semfile>.//<host.domainname>//'' instead.

A specific server or service may be signaled by "touching" the file ''[[dir:ctrl]]/<semfile>.//<service>//'' instead, where ''//<service>//'' is one of: ''term, ftp, mail, web, or services''.

==== Recycle Semaphore Files ====

Synchronet servers and services can be forced to terminate all threads, close sockets, and reload their configuration files by "touching" the file ''[[dir:ctrl]]/recycle''.

Servers or services that have the ''NO_RECYCLE'' option flag set (in the ''[[sbbs.ini]]'' file) will **not** be recycled by external touching of the //recycle// semaphore file.

:!:\\
If touching the ''recycle'' semaphore file does not trigger an ''sbbs'' server/services recycle (e.g. on Linux), see [[faq:nix#recycle]] for details on why that may be.

==== Shutdown Semaphore Files ====

Synchronet servers and services can be forced to terminate (shutdown) by "touching" the file ''[[dir:ctrl]]/shutdown''.

==== Clear Failed Login List Semaphore Files ====

A sysop can clear the in-memory //Failed Login List// (temporary IP address ban list) by "touching" the file ''[[dir:ctrl]]/clear''.

===== See Also =====
  * [[:config:|Configuration]]


{{tag>configuration semaphore semfile messaging event}}
