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
howto:systemd [2022/06/27 14:02] – [Ubuntu 16.04+] added LimitNOFILE and LimitCORE nelginhowto:systemd [2023/04/07 12:28] (current) – Wording digital man
Line 1: Line 1:
-====== Start Synchronet BBS from systemd ======+====== Start, Control, and Monitor Synchronet BBS using systemd ======
  
-If you run a 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).+If you run a modern GNU/Linux distribution, it is likely using [[https://en.wikipedia.org/wiki/Systemd|systemd]] as its "init systemfor starting and controlling system services/daemons. Installing Synchronet into systemd is recommended for such systems so that Synchronet will start upon system boot and provide all the control and monitoring expected of an integrated system service.
  
-In this case, instead of use the old SysV-style /etc/init.d/sbbs.service init script, you use a systemd services unit file:+===== Install =====
  
-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):+If you've installed Synchronet, you should already have the required [[https://gitlab.synchro.net/main/sbbs/-/raw/master/install/systemd/sbbs.service|system service unit file]] in the following location: 
 +  sbbs/repo/install/systemd/sbbs.service 
 +   
 +Read [[https://gitlab.synchro.net/main/sbbs/-/raw/master/install/systemd/sbbs.service|this file]] for the current instructions on how to install and configure it, but here's a summary for quick reference:
  
-===== Where is My Service File? =====+  - Copy or symlink the ''sbbs.service'' file to the correct directory, e.g. for Debian/Ubuntu Linux, that would be: ''/lib/systemd/system'' 
 +  - Enable the BBS service by running: ''sudo systemctl enable sbbs'' 
 +  - To run the BBS service without rebooting, run: ''sudo systemctl start sbbs''
  
-If you are already running Synchronet from systemd but can't remember where the config file is, the following commands will help.+Any necessary edits should be made using ''sudo systemctl edit sbbs'', thus creating the file: 
 +  /etc/systemd/system/sbbs.service.d/override.conf 
 +This will allow you to integrate any future upstream changes to the ''sbbs.service'' file without losing your local changes.
  
-''systemctl status'', then when viewing the file type ''/sbbs''Note the service name (probably sbbs.service). ''q'' to quit back to the command line.+After editing the ''sbbs.service'' or ''overrride.conf'' file, execute the following command to tell systemd to reload the unit files: 
 +  sudo systemctl daemon-reload
  
-Use that service name to return the path to the config file. Example: ''systemctl show -p FragmentPath sbbs.service''+==== Recommended Tweaks to the Service Section ==== 
 +To allow core file generation (for crash/segfault debugging), add to the ''[Service]'' section of your service unit file:
  
- +<file sbbs.service> 
-===== Ubuntu 16.04+ ===== +LimitCORE=infinity
-''/lib/systemd/system/sbbs.service'' +
-<file+
-[Unit] +
-  Description=Synchronet BBS service +
-  Documentation=man:sbbs +
-  After=syslog.target network.target +
-   +
-[Service] +
-  Type=forking +
-  Environment=SBBSROOT=/sbbs SBBSCTRL=/sbbs/ctrl +
-  # this stops your running out of files +
-  LimitNOFILE=10000 +
-  # this enables you to take a good core dump +
-  LimitCORE=infinity +
-  User=sbbs +
-  Group=sbbs +
-  PermissionsStartOnly=true +
-  ExecStart=/sbbs/exec/sbbs d +
-  ExecReload=/bin/kill -HUP $MAINPID +
-  Restart=on-failure +
-  RestartSec=30 +
-   +
-[Install] +
-  WantedBy=multi-user.target+
 </file> </file>
  
-Some points in this config: +==== Where is My Service File? ====
-   * **After**. If you are using syslog with sbbs, so it is nice to put that requirement before systemd tries to launch sbbs. +
-   * **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. +
-   * **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. +
-   * **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.+
  
-Installation instructions: +If you are already running Synchronet from systemd but can'remember where the config file is, the following commands will help.
-  -Modify the environment variables to match your SBBS setup +
-  -Modify User and Group. If you run this as root you don'need the ExecStartPre line. +
-  -Modify the ExecStart and ExecStartPre paths to match your Synchronet setup. +
-  -Place this file in the correct locationFor Ubuntu 16.04 you should place it in /lib/systemd/system +
-  -Enable the service with "systemctl enable sbbs" +
-  -To run the service without restarting "systemctl start sbbs"+
  
-Running //systemctl status sbbs// will show:+  systemctl show -p FragmentPath sbbs
  
-  ● sbbs.service - Synchronet BBS service + 
-    Loaded: loaded (/lib/systemd/system/sbbs.service; enabled; vendor preset: enabled) +===== Control ===== 
-    Active: active (running) since Thu 2016-12-15 20:20:43 CET; 16s ago + 
-      Docs: man:sbbs +To start the Synchronet service 
-   Process: 12364 ExecStart=/sbbs/exec/sbbs d (code=exited, status=0/SUCCESS) +  systemctl start sbbs 
-  Main PID: 12374 (sbbs) + 
-     Tasks: 11 +To restart (stop and then start) the Synchronet service 
-    Memory: 30.1M +  systemctl restart sbbs
-       CPU: 223ms +
-    CGroup: /system.slice/sbbs.service +
-            └─12374 /sbbs/exec/sbbs d+
      
-  Dec 15 20:23:25 HISPAMSX sbbs[1226]: term Node 1 Telnet  ------- [----------] +To stop the Synchronet service 
-  Dec 15 20:23:31 HISPAMSX sbbs[1226]: term Node 1 Terminal not detected, reducing inactivity hang-up timeout to 75 seconds +  systemctl stop sbbs 
-  Dec 15 20:23:36 HISPAMSX sbbs[1226]: term Node 1 Unknown User 'Enable' +   
-  Dec 15 20:24:02 HISPAMSX sbbs[1226]: term Node 1 disconnected +===== Monitor =====
-  Dec 11 20:24:03 HISPAMSX sbbs[1226]: term Node 1 thread terminated (0 node threads remain, 71 clients served)+
  
-**NOTE**:\\ +Display the current Synchronet service status
-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**'' +  systemctl status sbbs 
-===== Monitoring with Byobu (Tmux backend) =====+   
 +Watch the current Synchronet service status in real-time: 
 +  watch systemctl status sbbs 
 +   
 +Read/search the log output of the Synchronet service: 
 +  journalctl -sbbs 
 +   
 +Watch the log output of the Synchronet service in real-time: 
 +  journalctl -f -u sbbs 
 + 
 +==== 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.
  
Line 111: Line 89:
  
 {{:monitor:sbbs_monitor_byobu_4pane.png?200|}} {{:monitor:sbbs_monitor_byobu_4pane.png?200|}}
-===== Debian & CentOS 7 =====  
  
-/etc/default/sbbs +==== Debian (alternative using tmux) ====
-  SBBSCTRL=/sbbs/ctrl +
- +
-/etc/systemd/system/sbbs.service  +
-  [Unit] +
-  Description=Synchronet BBS +
-  Documentation=man:sbbs +
-  After=network.target +
-   +
-  [Service] +
-  Restart=on-failure +
-  EnvironmentFile=-/etc/default/sbbs +
-  ExecStart=/sbbs/exec/sbbs nd +
-  ExecReload=/bin/kill -HUP $MAINPID +
-  User=root +
-  Group=root +
-   +
-  [Install] +
-  WantedBy=multi-user.target +
- +
- +
-Finally, you must execute //systemd daemon-reload// for tell systemd to reload the unit file +
- +
-Test your setup: +
- +
-  # systemctl status sbbs +
-  ● sbbs.service - Synchronet BBS +
-     Loaded: loaded (/etc/systemd/system/sbbs.service; enabled) +
-     Active: active (running) since lun 2016-11-21 14:39:53 ART; 24min ago +
-       Docs: man:sbbs +
-    Process: 14393 ExecStart=/sbbs/exec/sbbs nd (code=exited, status=0/SUCCESS) +
-   Main PID: 14393 (sbbs) +
-     CGroup: /system.slice/sbbs.service +
-             └─14393 /sbbs/exec/sbbs nd +
-   +
-  nov 21 14:39:53 scarlet systemd[1]: Started Synchronet BBS. +
- +
- +
-===== Debian (alternative using tmux) =====+
  
 You can use [[https://en.wikipedia.org/wiki/Tmux|Tmux]] to still the Synchronet BBS console running on a screen that can be attached when you need You can use [[https://en.wikipedia.org/wiki/Tmux|Tmux]] to still the Synchronet BBS console running on a screen that can be attached when you need
Line 182: Line 121:
  
 {{:howto:sbbs_tmux.png?200|}} {{:howto:sbbs_tmux.png?200|}}
- 
-===== Recommended Tweaks to the Service Section === 
-Add these to the ''[Service]'' section of your service's config file: 
- 
-To increase the open file limit: 
-<file sbbs.service> 
-LimitNOFILE=10000 
-</file> 
- 
-To allow core file generation (for crash/segfault debugging: 
-<file sbbs.service> 
-LimitCORE=infinity 
-</file> 
  
 ===== See Also ===== ===== See Also =====
   * [[:howto:|howto index]]   * [[:howto:|howto index]]
 +  * [[https://gitlab.synchro.net/main/sbbs/-/raw/master/install/systemd/ircd.service|ircd service unit file]] - to run the Synchronet ircd separately from sbbs, as a systemd service, using JSexec
   * [[https://synchronetbbs.org/index.php/downloads]] - Alternate startup script that uses "screen" rather than tmux and restarts the server if it should crash.   * [[https://synchronetbbs.org/index.php/downloads]] - Alternate startup script that uses "screen" rather than tmux and restarts the server if it should crash.
 {{tag>linux systemd}} {{tag>linux systemd}}