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

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
howto:systemd [2019/09/04 13:22] – typo digital manhowto:systemd [2021/01/01 13:44] – [Ubuntu 16.04+] Retros tip from IRC digital man
Line 1: Line 1:
 ====== Start Synchronet BBS from Systemd ====== ====== Start Synchronet BBS from Systemd ======
  
-If you run modern GNU/Linux distributions, you can found [[https://en.wikipedia.org/wiki/Systemd|Systemd]] as init system (like Debian, Fedora and others).+If you run modern GNU/Linux distribution, you will likely discover [[https://en.wikipedia.org/wiki/Systemd|Systemd]] is used as the init system (for starting and control system services/daemons).
  
-Instead of use the old /etc/init.d/sbbs.service init script, you can create a systemd services unit file:+In this case, instead of use the old SysV-style /etc/init.d/sbbs.service init script, you use a systemd services unit file:
  
-Create and edit the follow files (please correct your ExecStart path and User/Group as you need):+Create and edit (or download from [[http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/install/systemd/sbbs.service|here]]) the following file (please correct your ExecStart path and User/Group as you need):
  
 ===== Ubuntu 16.04+ ===== ===== Ubuntu 16.04+ =====
-/lib/systemd/system/sbbs.service +''/lib/systemd/system/sbbs.service'' 
-  [Unit]+<file> 
 +[Unit]
   Description=Synchronet BBS service   Description=Synchronet BBS service
   Documentation=man:sbbs   Documentation=man:sbbs
   After=syslog.target network.target   After=syslog.target network.target
      
-  [Service]+[Service]
   Type=forking   Type=forking
   Environment=SBBSROOT=/sbbs SBBSCTRL=/sbbs/ctrl   Environment=SBBSROOT=/sbbs SBBSCTRL=/sbbs/ctrl
Line 20: Line 21:
   Group=sbbs   Group=sbbs
   PermissionsStartOnly=true   PermissionsStartOnly=true
-  ExecStartPre=/sbin/setcap 'cap_net_bind_service=+ep' /sbbs/src/sbbs3/gcc.linux.x64.exe.release/sbbs 
   ExecStart=/sbbs/exec/sbbs d   ExecStart=/sbbs/exec/sbbs d
   ExecReload=/bin/kill -HUP $MAINPID   ExecReload=/bin/kill -HUP $MAINPID
Line 26: Line 26:
   RestartSec=30   RestartSec=30
      
-  [Install]+[Install]
   WantedBy=multi-user.target   WantedBy=multi-user.target
 +</file>
  
 Some points in this config: Some points in this config:
Line 35: Line 36:
    * **User/Group**. **Remove these** if you would like sbbs to start as root and then drop privileges to the User & Group configured in your sbbs.ini. Possibly remove **PermissionsStartOnly** and **ExecStartPre** as well, as they would be unnecessary.   If you leave these in, ensure the User/Group settings in sbbs.ini are commented out.    * **User/Group**. **Remove these** if you would like sbbs to start as root and then drop privileges to the User & Group configured in your sbbs.ini. Possibly remove **PermissionsStartOnly** and **ExecStartPre** as well, as they would be unnecessary.   If you leave these in, ensure the User/Group settings in sbbs.ini are commented out.
    * **PermissionsStartOnly**. This one tells systemd to execute ExecStartPre as root, but ExecStart as the user and group declared in User,Group.  Can be removed if you remove the User/Group lines.    * **PermissionsStartOnly**. This one tells systemd to execute ExecStartPre as root, but ExecStart as the user and group declared in User,Group.  Can be removed if you remove the User/Group lines.
-   * **ExecStartPre**. Capabilities are lost from the sbbs executable every time it is recompiled. It is possible to mitigate the effect by running setcap just before the daemon is ran. The binding won't fail anymore using this. Please notice you can't point a symlink here, so modify the architecture directory to the right path (gcc.linux.x64.exe.release or gcc.linux.exe.release). 
    * **ExecStart**. If you don't want to get syslog entries duplicated you will have to run SBBS in daemonized mode, so the "d" parameter is used. Syslog is implicit when daemonized, so there is no need for additional parameters.     * **ExecStart**. If you don't want to get syslog entries duplicated you will have to run SBBS in daemonized mode, so the "d" parameter is used. Syslog is implicit when daemonized, so there is no need for additional parameters. 
    * **RestartSec**. It's advisable to wait some secs before attempting restarting in case of failure, just to give some time for binding release.    * **RestartSec**. It's advisable to wait some secs before attempting restarting in case of failure, just to give some time for binding release.
Line 54: Line 54:
       Docs: man:sbbs       Docs: man:sbbs
    Process: 12364 ExecStart=/sbbs/exec/sbbs d (code=exited, status=0/SUCCESS)    Process: 12364 ExecStart=/sbbs/exec/sbbs d (code=exited, status=0/SUCCESS)
-   Process: 12356 ExecStartPre=/sbin/setcap cap_net_bind_service=+ep /sbbs/src/sbbs3/gcc.linux.x64.exe.release/sbbs (code=exited, status 
   Main PID: 12374 (sbbs)   Main PID: 12374 (sbbs)
      Tasks: 11      Tasks: 11
Line 68: Line 67:
   Dec 11 20:24:03 HISPAMSX sbbs[1226]: term Node 1 thread terminated (0 node threads remain, 71 clients served)   Dec 11 20:24:03 HISPAMSX sbbs[1226]: term Node 1 thread terminated (0 node threads remain, 71 clients served)
  
 +**NOTE**:\\
 +If you're running any kind of recent (last 2yrs+) systemd, to avoid the use of ''[[howto:linux_non-root|setcap]]'' to run 'sbbs' as a non-root user, just put this line in the ''[Service]'' section of your ''sbbs.service'' file:  ''**AmbientCapabilities=CAP_NET_BIND_SERVICE**''
 ===== Monitoring with Byobu (Tmux backend) ===== ===== Monitoring with Byobu (Tmux backend) =====
 You can have a text mode dashboard for monitoring and configuring your BBS realtime by using Byobu with Tmux or GNU Screen backends. If you are using the Tmux backend. The following configuration splits your screen in three panes: one for SBBS log, other for UMONITOR and a last one for SCFG. Please note that this configuration assumes SBBSCTRL variable is set and that access permissions to the needed files are set for the current user. You can have a text mode dashboard for monitoring and configuring your BBS realtime by using Byobu with Tmux or GNU Screen backends. If you are using the Tmux backend. The following configuration splits your screen in three panes: one for SBBS log, other for UMONITOR and a last one for SCFG. Please note that this configuration assumes SBBSCTRL variable is set and that access permissions to the needed files are set for the current user.