website

My personal website
git clone git://git.ckyln.com/website
Log | Files | Refs

index.html (4142B)


      1 <!DOCTYPE HTML>
      2 <html lan=en>
      3   <head>
      4     <title>SYSMGR | Cem's Website</title>
      5     <meta charset="utf-8">
      6     <meta name="Description" content="Cem Keylan's Website">
      7     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      8     <style>
      9       html {font-family:monospace;font-size:16px;color:#282a36;}
     10       body {
     11 	  width: 90%;
     12 	  max-width: 1050px;
     13 	  margin-left: auto;
     14 	  margin-right: auto;
     15 	  margin-top: 20px;
     16 	  overflow: none;
     17           overflow-y: scroll;
     18 	  padding-right: 10px;
     19 	  padding-left: 10px;
     20       }
     21       a{text-decoration:none;font-weight:bold;color:#282a36;}
     22       a:hover{text-decoration:underline;}
     23       @media (prefers-color-scheme: dark) {
     24           html {color: white;background:#282a36;}
     25           a{color:white;}
     26       }
     27     </style>
     28     <link rel="stylesheet" href="/static/syntax.css">
     29     <script src="/static/highlight.pack.js"></script>
     30     <script>hljs.initHighlightingOnLoad();</script>
     31   </head>
     32   <body>
     33     <div class="header">
     34       <nav>
     35         <a href='/'>index</a> |
     36         <a href="/software.html">software</a> |
     37         <a href="/blog.html">blog</a> |
     38         <a href="/contact.html">contact</a> |
     39         <a href="/sysmgr">sysmgr</a> |
     40       </nav>
     41     </div>
     42     <hr>
     43     <p>
     44 <h1>SYSMGR</h1>
     45 
     46 <p>sysmgr is a service manager that aims to do as little as possible for service
     47 supervision. It can be viewed as a simplified version of <a href="http://smarden.org/runit">runit</a>. It only cares
     48 about making sure certain processes are alive unless explicitly stopped. Unlike
     49 runit, it doesn&rsquo;t care about logging, or stopping daemons with special commands,
     50 as those can easily be handled by service scripts themselves. It doesn&rsquo;t have
     51 supervise directories with FIFOs inside. It <em>ONLY</em> cares about processes and
     52 nothing else.</p>
     53 
     54 <h2>Interacting with sysmgr</h2>
     55 
     56 <p>While sysmgr can be interacted entirely with POSIX base tools, sysmgr provides
     57 a tool named &lsquo;svctl&rsquo; for interacting with sysmgr. This tool can be used to check
     58 the status and start/stop/restart services.</p>
     59 
     60 <p>When sysmgr picks up a service script inside the service directory, it
     61 automatically starts the service unless stopped.</p>
     62 
     63 <h2>Details of implementation</h2>
     64 
     65 <p>The initial implementation of sysmgr was written in POSIX shell, and it used
     66 POSIX compliant base-tools, however, in order to spawn as little processes as
     67 possible, it did some Linuxisms which prevented portability. The current
     68 implementation is written in C99, and it only uses functions from the POSIX-2008
     69 C Library, so it should work on all POSIX-compatible systems. Testing required.</p>
     70 
     71 <h2>Building and installing</h2>
     72 
     73 <p>Before building sysmgr, it is best to take a look at the config.h and config.mk
     74 files, and modify them to fit your system. Afterwards you can do the following
     75 (as root if necessary):</p>
     76 
     77 <pre><code>make
     78 make install
     79 </code></pre>
     80 
     81 <p>You can then install service scripts to your service directory and run sysmgr.</p>
     82 
     83 <h2>Service scripts</h2>
     84 
     85 <p>Service scripts can be any executable ranging from shell scripts to C binaries.
     86 The only requirement is that they can be executable. An example script is as
     87 follows:</p>
     88 
     89 <pre><code>#!/bin/sh -e
     90 exec httpd -f -p 8080 -h /var/pub/www
     91 </code></pre>
     92 
     93 <p>The exec call in the shell script makes sure that sysmgr is tracking the process
     94 id of the httpd program rather than the shell script. It isn&rsquo;t necessary, but it
     95 is the best practice to do so.</p>
     96 
     97 <p>On certain occasions a service can depend on other services to be able to start.
     98 That&rsquo;s why a sysmgr-depends tool is supplied, in order to make sure a service
     99 can wait until another service is up.</p>
    100 
    101 <pre><code>#!/bin/sh -e
    102 sysmgr-depends dbus
    103 exec NetworkManager -n
    104 </code></pre>
    105 
    106 <h2>More information</h2>
    107 
    108 <p>More usage information can be found on the following manual pages:</p>
    109 
    110 <ul>
    111 <li>runsyssv(1)</li>
    112 <li>svctl(1)</li>
    113 <li>sysmgr(8)</li>
    114 <li>sysmgr-depends(1)</li>
    115 </ul>
    116 
    117     </p>
    118     <a href="/sysmgr/index.txt">This page in plain-text</a>
    119     <hr>
    120     <p class=footer>Copyright &copy; 2019-2021 Cem Keylan</p>
    121   </body>
    122 </html>