Differences

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

Link to this comparison view

Next revision
Previous revision
howto:systemd [2016/11/21 09:52] – created ragnarokhowto:systemd [2023/04/07 12:28] (current) – Wording digital man
Line 1: Line 1:
-====== Start Synchornet BBS from Systemd ======+====== Start, Control, and Monitor Synchronet BBS using systemd ======
  
-If you run modern GNU/Linux distribution, you can found systemd as init system (Debian, Fedora and others).+If you run modern GNU/Linux distribution, it is likely using [[https://en.wikipedia.org/wiki/Systemd|systemd]] as its "init system" for 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.
  
-Instead of use the old /etc/init.d/sbbs.service init script, you can create a systemd services unit file:+===== Install =====
  
-Debian:+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:
  
-Create and edit the follow 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''
  
-/etc/systemd/system/sbbs.service +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.
  
 +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
 +
 +==== 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>
 +LimitCORE=infinity
 +</file>
 +
 +==== Where is My Service File? ====
 +
 +If you are already running Synchronet from systemd but can't remember where the config file is, the following commands will help.
 +
 +  systemctl show -p FragmentPath sbbs
 +
 +
 +===== Control =====
 +
 +To start the Synchronet service
 +  systemctl start sbbs
 +
 +To restart (stop and then start) the Synchronet service
 +  systemctl restart sbbs
 +  
 +To stop the Synchronet service
 +  systemctl stop sbbs
 +  
 +===== Monitor =====
 +
 +Display the current Synchronet service status:
 +  systemctl status sbbs
 +  
 +Watch the current Synchronet service status in real-time:
 +  watch systemctl status sbbs
 +  
 +Read/search the log output of the Synchronet service:
 +  journalctl -u 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.
 +
 +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 (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
 +
 +/etc/default/sbbs
 +  SBBSCTRL=/sbbs/ctrl
 +
 +/etc/systemd/system/sbbs.service 
   [Unit]   [Unit]
   Description=Synchronet BBS   Description=Synchronet BBS
   Documentation=man:sbbs   Documentation=man:sbbs
   After=network.target   After=network.target
 +  
   [Service]   [Service]
   Restart=on-failure   Restart=on-failure
 +  Type=forking
 +  KillMode=none
   EnvironmentFile=-/etc/default/sbbs   EnvironmentFile=-/etc/default/sbbs
-  ExecStart=/sbbs/exec/sbbs nd +   
-  ExecReload=/bin/kill -HUP $MAINPID +  ExecStart=/usr/bin/tmux new-session -d -s sbbs '/sbbs/exec/sbbs nd' 
 +  ExecStop=/usr/bin/tmux send-keys -t sbbs 'q' C-m 'exit' C-m 
 +  
   User=root   User=root
   Group=root   Group=root
 +  
   [Install]   [Install]
   WantedBy=multi-user.target   WantedBy=multi-user.target
  
 +Using tmux, Synchronet start in a session (called sbbs), you can attach to the running console using //tmux attach -t sbbs//
  
 +{{:howto:sbbs_tmux.png?200|}}
  
 ===== 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 
-{{tag>}}+  * [[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}}
  
howto/systemd.1479750734.txt · Last modified: 2016/11/21 09:52 by ragnarok
Back to top
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0