Synchronet v3.18b-Win32 (install) has been released (Sept-2020).

Synchronet is switching to Git

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 revision Previous revision
Next revision
Previous revision
howto:systemd [2018/01/07 18:23]
digital man Added nelgin's recommendations
howto:systemd [2020/01/31 12:04] (current)
digital man Clean-up. Provide download link to sbbs.service in CVS. Use wildcards in setcap command.
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+  ExecStartPre=/​sbin/​setcap '​cap_net_bind_service=+ep'​ /​sbbs/​src/​sbbs3/​gcc.linux.*.exe.*/sbbs
   ExecStart=/​sbbs/​exec/​sbbs d   ExecStart=/​sbbs/​exec/​sbbs d
   ExecReload=/​bin/​kill -HUP $MAINPID   ExecReload=/​bin/​kill -HUP $MAINPID
Line 26: Line 27:
   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 33: Line 35:
    * **Type**. If you are to run SBBS in daemonized mode, the main executable will exit after the daemon is called. This could confuse systemd into thinking the process is finished. If you use "​Type=forking"​ you tell systemd that the process you launch will execute another process.    * **Type**. If you are to run SBBS in daemonized mode, the main executable will exit after the daemon is called. This could confuse systemd into thinking the process is finished. If you use "​Type=forking"​ you tell systemd that the process you launch will execute another process.
    * **Environment**. In order to avoid having multiple files, you can embed the variables inside the service file.    * **Environment**. In order to avoid having multiple files, you can embed the variables inside the service file.
-   * **PermissionsStartOnly**. This one tells systemd to execute ExecStartPre as root, but ExecStart as the user and group declared in User,​Group. +   * **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. 
-   * **ExecStartPre**. ​For some weird reason, capabilities ​are frequently ​lost from the sbbs executable. 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).+   * **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 to a symlink here).
    * **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 67: Line 70:
   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)
  
 +===== 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.
  
 +Create the file ''​$BYOBU_CONFIG_DIR/​windows.tmux.sbbs''​ with the following contents:
 +
 +  new-session sbbs ;
 +  new-window -n sbbs tail -n 50 -f /​var/​log/​sbbs.log ;
 +  split-window -h /​sbbs/​exec/​umonitor ;
 +  split-window -t 1 -v /​sbbs/​exec/​scfg ;
 +  set-option mouse on
 +
 +And then run: ''​user@localhost:​~$ BYOBU_WINDOWS=sbbs byobu''​
 +
 +If you want this to be your default environment when you log at your Synchronet server, then write the configuration to the ''​$BYOBU_CONFIG_DIR/​windows.tmux''​ file instead of ''​$BYOBU_CONFIG_DIR/​windows.tmux.sbbs''​
 +
 +The following screenshot shows the result:
 +
 +{{:​monitor:​sbbs_monitor_byobu.png?​200|}}
 +
 +If are using also **binkd** for FidoNet, this configuration will split the dashboard in 4 panes:
 +
 +  new-session sbbs ;
 +  new-window -n sbbs tail -n 50 -f /​var/​log/​sbbs.log ;
 +  split-window -p 50 -h /​sbbs/​exec/​umonitor ;
 +  split-window -t 0 -p 20 -v tail -f /​var/​log/​binkd.log ;
 +  split-window -t 1 -v /​sbbs/​exec/​scfg ;
 +  set-option mouse on
 +
 +{{:​monitor:​sbbs_monitor_byobu_4pane.png?​200|}}
 ===== Debian & CentOS 7 =====  ===== Debian & CentOS 7 ===== 
  
Line 151: Line 182:
 ===== See Also ===== ===== See Also =====
   * [[:​howto:​|howto index]]   * [[:​howto:​|howto index]]
- +  * [[https://​synchronetbbs.org/​index.php/​downloads]] - Alternate startup script that uses "​screen"​ rather than tmux and restarts the server if it should crash. 
-{{tag>}}+{{tag>linux systemd}}
  

In Other Languages