runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

runscripts.html (25919B)


      1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
      2 <html>
      3 <head>
      4 <title>runit - collection of run scripts</title>
      5 </head>
      6 <body>
      7 <a href="http://smarden.org/pape/">G. Pape</a><br>
      8 <a href="index.html">runit</a><br>
      9 <a href="replaceinit.html">How to replace init</a>
     10 <hr>
     11 <h1>runit - collection of run scripts</h1>
     12 <hr>
     13 This is a collection of <tt>run</tt> scripts for popular services to have
     14 them monitored by the
     15 <a href="http://cr.yp.to/daemontools.html">daemontools</a> or
     16 <a href="http://smarden.org/runit/">runit</a> package.
     17 If you have additional run scripts or one of these run scripts works for you on
     18 an operating system not stated here, please
     19 <a href="mailto:supervision@list.skarnet.org">let me know</a>. 
     20 <p>
     21 Thanks go to the following people for contributing run scripts:
     22 <small>
     23 Alessandro Bono, Robin S. Socha, Claus Alboege, Paul Jarc, clemens fischer,
     24 Jesse Cablek, Lukas Beeler, Thomas Baden, Ralf Hildebrandt, Antonio Dias,
     25 Erich Schubert, Lang Martin, Tomasz Nidecki, Marek Bartnikowski,
     26 Thomas Schwinge, Gael Canal, Woon Wai Keen, Richard A Downing, Phil Genera,
     27 Stefan Karrmann, Kevin Berry, Karl Chen, Sascha Huedepohl, Jason Smith,
     28 Kevin, marlowe, ed neville, xavier dutoit.
     29 </small>
     30 <p>
     31 See also
     32 <a href="http://thedjbway.org/services.html">here</a> for some more run
     33 scripts.
     34 <hr>
     35 <a href="#atftpd">atftpd</a><br>
     36 <a href="#apache">apache</a><br>
     37 <a href="#apache2">apache2</a><br>
     38 <a href="#atd">atd</a><br>
     39 <a href="#bind9">bind9</a><br>
     40 <a href="#boa">boa</a><br>
     41 <a href="#cfengine">cfengine</a><br>
     42 <a href="#cfsd">cfsd</a><br>
     43 <a href="#chrony">chrony</a><br>
     44 <a href="#clamav">clamav</a><br>
     45 <a href="#clamsmtpd">clamsmtpd</a><br>
     46 <a href="#courier-imap">courier-imap</a><br>
     47 <a href="#cron">cron</a><br>
     48 <a href="#cups">cups</a><br>
     49 <a href="#dhclient">dhclient</a><br>
     50 <a href="#dhcpcd">dhcpcd</a><br>
     51 <a href="#dhcpd">dhcpd</a><br>
     52 <a href="#dictd">dictd</a><br>
     53 <a href="#dropbear">dropbear</a><br>
     54 <a href="#exim">exim</a><br>
     55 <a href="#expireproctitle">expireproctitle</a><br>
     56 <a href="#fam">fam</a><br>
     57 <a href="#fcron">fcron</a><br>
     58 <a href="#fetchmail">fetchmail</a><br>
     59 <a href="#gdm">gdm</a><br>
     60 <a href="#getty">getty</a><br>
     61 <a href="#gpm">gpm</a><br>
     62 <a href="#hotwayd">hotwayd</a><br>
     63 <a href="#identd">identd</a><br>
     64 <a href="#inn">inn</a><br>
     65 <a href="#jabberd">jabberd</a><br>
     66 <a href="#junkbuster">junkbuster</a><br>
     67 <a href="#kdm">kdm</a><br>
     68 <a href="#keepalived">keepalived</a><br>
     69 <a href="#klogd">klogd</a><br>
     70 <a href="#leafnode">leafnode</a><br>
     71 <a href="#loglinuxkernel">logging Linux kernel messages</a><br>
     72 <a href="http://multivac.cwru.edu./fdtools/grabconsole/">
     73 logging console messages</a><br>
     74 <a href="#mdadm">mdadm</a><br>
     75 <a href="#minidentd">minidentd</a><br>
     76 <a href="#mpd">mpd</a><br>
     77 <a href="#nscd">nscd</a><br>
     78 <a href="#ntpd">ntpd</a><br>
     79 <a href="#nullidentd">nullidentd</a><br>
     80 <a href="#polipo">polipo</a><br>
     81 <a href="#pop3-ssl">pop3-ssl</a><br>
     82 <a href="#pop3vscan">pop3vscan</a><br>
     83 <a href="#portmap">portmap</a><br>
     84 <a href="#postfix">postfix</a><br>
     85 <a href="#postgresql">postgresql</a><br>
     86 <a href="#powernowd">powernowd</a><br>
     87 <a href="#ppp">ppp</a><br>
     88 <a href="#privoxy">privoxy</a><br>
     89 <a href="#proftpd">proftpd</a><br>
     90 <a href="#pure-ftpd">pure-ftpd</a><br>
     91 <a href="#radiusd">radiusd</a><br>
     92 <a href="#rmrtg">rmrtg</a><br>
     93 <a href="#rsyncd">rsyncd</a><br>
     94 <a href="#samba">samba (smbd, nmbd)</a><br>
     95 <a href="#shoutcast">shoutcast</a><br>
     96 <a href="#spamd">spamd</a><br>
     97 <a href="#squid">squid</a><br>
     98 <a href="#sshd">sshd</a><br>
     99 <a href="#sshdtcpserver">sshd under tcpserver</a><br>
    100 <a href="#statd">statd</a>, <a href="#mountd">mountd</a><br>
    101 <a href="#stunnel">stunnel</a><br>
    102 <a href="#subversion">subversion</a><br>
    103 <a href="#swat">swat</a><br>
    104 <a href="#syslogd">syslogd</a><br>
    105 <a href="#taiclockd">taiclockd</a><br>
    106 <a href="#tmda-ofmipd">tmda-ofmipd</a><br>
    107 <a href="#tomcat">tomcat</a><br>
    108 <a href="#tor">tor</a><br>
    109 <a href="#vsftpd">vsftpd</a><br>
    110 <a href="#wvdial">wvdial</a><br>
    111 <a href="#xdm">xdm</a><br>
    112 <a href="#xfs">xfs</a><br>
    113 <hr>
    114 
    115 <h3><a name="atftpd">An <tt>atftpd</tt> run script</a></h3>
    116 (<i>Debian</i>)
    117 <pre>
    118  #!/bin/sh
    119  exec in.tftpd --daemon --no-fork --tftpd-timeout 30 \
    120    --retry-timeout 5 --no-tsize --no-blksize --no-multicast \
    121    --maxthread 1000 --verbose=7 /var/atfpd 2&gt;&amp;1
    122 </pre>
    123 <hr>
    124 <h3><a name="apache">An <tt>apache</tt> run script</a></h3>
    125 (<i>SunOS</i>, Apache 1.*, patched to run under supervise)
    126 <pre>
    127  #!/bin/sh
    128  exec 2&gt;&amp;1
    129  exec env -i \
    130  /pack/apache/1.3.27-1/sbin/httpd -F 2&gt;&amp;1
    131 </pre>
    132 (<i>Debian woody</i>)
    133 <pre>
    134  #!/bin/sh
    135  exec 1&gt;&amp;2
    136  exec apache-ssl -F
    137 </pre>
    138 <hr>
    139 <h3><a name="apache2">An <tt>apache2</tt> run script</a></h3>
    140 (<i>SunOS</i>)
    141 <pre>
    142  #!/bin/sh
    143  exec 2&gt;&amp;1
    144  exec env -i /command/pgrphack \
    145  /pack/apache/2.0.43-1/sbin/httpd -DFOREGROUND 2&gt;&amp;1
    146 </pre>
    147 (<i>HP-UX/GNU</i>, <i>Linux</i>)
    148 <pre>
    149  #!/bin/sh
    150  TZ=MET-1METDST
    151  export TZ
    152  exec /usr/local/apache2/bin/httpd -DNO_DETACH
    153 </pre>
    154 <hr>
    155 <h3><a name="atd">An <tt>atd</aa> run script</a></h3>
    156 (<i>Debian sarge</i>)
    157 <pre>
    158  #!/bin/sh
    159  exec 2&gt;&amp;1
    160  exec atd -d
    161 </pre>
    162 <hr>
    163 <h3><a name="bind9">A <tt>bind9</tt> run script</a></h3>
    164 (<i>Linux</i>)
    165 <pre>
    166  #!/bin/sh
    167  MEM="`head -1 ./env/MEM`"
    168  CHROOT="`head -1 ./env/CHROOT`"
    169  exec softlimit -m "${MEM}" \
    170    named -u bind -t "${CHROOT}" -g 2&gt;&amp;1
    171 </pre>
    172 (<i>HP-UX/GNU</i>, <i>Linux</i>)
    173 <pre>
    174  #!/bin/sh
    175  exec named -f -t /var/spool/named/ -u named
    176 </pre>
    177 <hr>
    178 <h3><a name="boa">A <tt>boa</tt> run script</a></h3>
    179 (<i>SunOS</i>)
    180 <pre>
    181  #!/bin/sh
    182  exec 2&gt;&amp;1
    183  ulimit -n 1024
    184  exec /pack/boa/current/boa -c /pack/boa/current -d 2&gt;&amp;1
    185 </pre>
    186 <hr>
    187 <h3><a name="cfengine">A <tt>cfengine</tt> run script</a></h3>
    188 (<i>SunOS</i>)
    189 <pre>
    190  #!/bin/sh
    191  /pack/cfengine/sbin/cfagent --file /pack/cfengine/etc/cfagent.conf \
    192    -L -v -q exec sleep 3600
    193 </pre>
    194 <hr>
    195 <h3><a name="cfsd">A <tt>cfsd</tt> run script</a></h3>
    196 (<i>Debian sarge</i>)
    197 <pre>
    198  #!/bin/sh
    199  exec 2&gt;&amp;1
    200  
    201  set -e
    202  
    203  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
    204  DAEMON=cfsd
    205  CONFIG_FILE=/etc/cfs.conf
    206  
    207  # source config file
    208  test ! -r "$CONFIG_FILE" || . "$CONFIG_FILE"
    209  
    210  test -n "$CRYPT_ROOT" || exit 0
    211  test -n "$NULL_EXPORT" || exit 0
    212  test -n "$CFS_MOUNT" || exit 0
    213  test -n "$CFS_UMOUNT" || exit 0
    214  
    215  sv start portmap || exit 1
    216  
    217  exec env \
    218     NODAEMON=1 CFS_MOUNT="$CFS_MOUNT" CFS_UMOUNT="$CFS_UMOUNT" $DAEMON
    219 </pre>
    220 <hr>
    221 <h3><a name="chrony">A <tt>chrony</tt> run script</a></h3>
    222 (<i>LFS</i>)
    223 <pre>
    224  #!/bin/sh
    225  exec 2&gt;&amp;1
    226  exec chronyd -d -r -s
    227 </pre>
    228 This service needs a
    229 <a href="faq.html#createlog">log service</a>
    230 to be set up.
    231 <hr>
    232 <h3><a name="clamav">A <tt>clamd</tt> run script</a></h3>
    233 (<i>RedHat 7</i>)
    234 <pre>
    235  #!/bin/sh
    236  exec 2&gt;&amp;1
    237  exec setuidgid clamav softlimit -a 40000000 clamd
    238 </pre>
    239 This service needs a
    240 <a href="faq.html#createlog">log service</a>
    241 to be set up.
    242 <hr>
    243 <h3><a name="clamsmtpd">A <tt>clamsmtpd</tt> run script</a></h3>
    244 (<i>Debian sarge</i>)
    245 <pre>
    246  #!/bin/sh
    247  exec 2&gt;&amp;1
    248  exec chpst -uclamav clamsmtpd -d 3
    249 </pre>
    250 This service needs a
    251 <a href="faq.html#createlog">log service</a>
    252 to be set up.
    253 <hr>
    254 <h3><a name="courier-imap">A <tt>courier-imap</tt> run script</a></h3>
    255 (<i>SunOS</i>)
    256 <pre>
    257  #!/bin/sh
    258  exec 2&gt;&amp;1
    259  PREFIX="/usr/lib/courier-imap"
    260  exec envdir ./env \
    261    tcpserver -v -R 0 143 \
    262    $PREFIX/sbin/imaplogin \
    263    $PREFIX/libexec/authlib/authshadow \
    264    $PREFIX/libexec/authlib/authvchkpw \
    265    $PREFIX/bin/imapd Maildir
    266 </pre>
    267 See also <a href="http://jonaspasche.de/courier-imap-daemontools.txt">
    268 this page</a>.
    269 <hr>
    270 <h3><a name="cron">A <tt>cron</tt> run script</a></h3>
    271 (<i>Debian sarge</i>)
    272 <pre>
    273  #!/bin/sh
    274  exec 2&gt;&amp;1
    275  exec cron -f -l
    276 </pre>
    277 <hr>
    278 <h3><a name="cups">A <tt>cups</tt> run script</a></h3>
    279 (<i>Debian woody</i>)
    280 <pre>
    281  #!/bin/sh
    282  exec 2&gt;&amp;1
    283  exec cupsd -f
    284 </pre>
    285 <hr>
    286 <h3><a name="dhclient">A <tt>dhclient</tt> run script</a></h3>
    287 (<i>Debian woody</i>)
    288 <pre>
    289  #!/bin/sh
    290  exec dhclient -e -d -cf ./config -lf ./leases -pf ./pid eth1
    291 </pre>
    292 <hr>
    293 <h3><a name="dhcpcd">A <tt>dhcpcd</tt> run script</a></h3>
    294 (<i>Linux</i>, DHCP Client Daemon v.scriptconfig-0.1)
    295 <pre>
    296  #!/bin/sh
    297  exec dhcpcd -a -d -D -H eth0
    298 </pre>
    299 <hr>
    300 <h3><a name="dhcpd">A <tt>dhcpd</tt> run script</a></h3>
    301 (<i>Debian woody</i>)
    302 <pre>
    303  #!/bin/sh
    304  exec 2&gt;&amp;1
    305  exec dhcpd-2.2.x -f -d -cf ./config eth0
    306 </pre>
    307 This service needs a
    308 <a href="faq.html#createlog">log service</a>
    309 to be set up.
    310 <p>
    311 (<i>Solaris 8</i>, uses additional dsvclockd service, would get fired off
    312 automatically, but then it's not supervised)
    313 <pre>
    314  #!/bin/sh
    315  exec 2&gt;&amp;1
    316  exec envdir ./env /usr/lib/inet/dsvclockd -f
    317 </pre>
    318 <pre>
    319  #!/bin/sh
    320  if svok /service/dsvclockd; then
    321    sleep 2 # wait to make sure dsvclockd is initialized
    322    exec 2&gt;&amp;1
    323    exec envdir ./env /usr/lib/inet/in.dhcpd -b manual -d # -v
    324  fi
    325  echo dsvclockd is not running - aborting
    326  exec /usr/bin/sleep 5
    327 </pre>
    328 The in.dhcpd service needs a
    329 <a href="faq.html#createlog">log service</a>
    330 to be set up.
    331 <hr>
    332 <h3><a name="dictd">A <tt>dictd</tt> run script</a></h3>
    333 (<i>Debian sarge</i>)
    334 <pre>
    335  #!/bin/sh
    336  exec 2&gt;&amp;1
    337  exec dictd -d nodetach
    338 </pre>
    339 <hr>
    340 <h3><a name="dropbear">A <tt>dropbear</tt> run script</a></h3>
    341 (<i>Linux</i>)
    342 <pre>
    343  #!/bin/sh
    344  exec 2&gt;&amp;1
    345  exec dropbear -F -E -p 22
    346 </pre>
    347 This service needs a
    348 <a href="faq.html#createlog">log service</a>
    349 to be set up.
    350 <p>
    351 (<i>Linux</i>, running under
    352 <a href="http://smarden.org/ipsvd/tcpsvd.8.html">tcpsvd</a>)
    353 <pre>
    354  #!/bin/sh
    355  exec 2&gt;&amp;1
    356  exec tcpsvd -v -i./peers 0 22 dropbear -i -E
    357 </pre>
    358 This service needs a
    359 <a href="faq.html#createlog">log service</a>
    360 to be set up.
    361 <hr>
    362 <h3><a name="exim">An <tt>exim</tt> run script</a></h3>
    363 (<i>Linux</i>, <i>FreeBSD</i>)
    364 <pre>
    365  #!/bin/sh
    366  exec /usr/local/sbin/exim -bdf -q30m
    367 </pre>
    368 <hr>
    369 <h3><a name="expireproctitle">
    370 <tt>expireproctitle</tt> run script examples</a></h3>
    371 (<i>Linux</i>)
    372 <pre>
    373  #!/bin/sh
    374  echo -n .
    375  exec sleep 300
    376 </pre>
    377 <hr>
    378 <h3><a name="fam">A <tt>fam</tt> run script</a></h3>
    379 (<i>Slackware Linux 9.0</i>)
    380 <pre>
    381  #!/bin/sh
    382  exec 2&gt;&amp;1
    383  exec fam -L -f -v
    384 </pre>
    385 This service needs a
    386 <a href="faq.html#createlog">log service</a>
    387 to be set up.
    388 <p>
    389 (<i>Debian sarge</i>)
    390 <pre>
    391  #!/bin/sh
    392  exec 2&gt;&amp;1
    393  sv start /service/portmap || exit 1
    394  exec famd -T 0 -f
    395 </pre>
    396 <hr>
    397 <h3><a name="postfix">A postfix <tt>master</tt> run script</a></h3>
    398 (<i>Debian etch</i>)
    399 <pre>
    400  #!/bin/sh
    401  exec 1>&2
    402  
    403  daemon_directory=/usr/lib/postfix \
    404  command_directory=/usr/sbin \
    405  config_directory=/etc/postfix \
    406  queue_directory=/var/spool/postfix \
    407  mail_owner=postfix \
    408  setgid_group=postdrop \
    409    /etc/postfix/postfix-script check || exit 1
    410  
    411  exec /usr/lib/postfix/master
    412 </pre>
    413 <hr>
    414 <h3><a name="fcron">A <tt>fcron</tt> run script</a></h3>
    415 (<i>LFS</i>)
    416 <pre>
    417  #!/bin/sh
    418  exec 2&gt;&amp;1
    419  exec fcron -f -y
    420 </pre>
    421 This service needs a
    422 <a href="faq.html#createlog">log service</a>
    423 to be set up.
    424 <hr>
    425 <h3><a name="fetchmail">A <tt>fetchmail</tt> run script</a></h3>
    426 (<i>Linux</i>)
    427 <pre>
    428  #!/bin/sh
    429  INTERVAL=551
    430  exec 2>&1
    431  echo "*** Starting fetchmail service..."
    432  exec env FETCHMAILHOME="./pid" \
    433    chpst -u fetchmail fetchmail -v \
    434      -f ./fetchmail.conf \
    435      --nodetach \
    436      --daemon ${INTERVAL}
    437 </pre>
    438 <hr>
    439 <h3><a name="gdm">A <tt>gdm</tt> run script</a></h3>
    440 (<i>Debian woody</i>)
    441 <pre>
    442  #!/bin/sh
    443  exec gdm -nodaemon
    444 </pre>
    445 <hr>
    446 <h3><a name="getty">A <tt>mingetty</tt> run script</a></h3>
    447 (<i>Debian</i>)
    448 <pre>
    449  #!/bin/sh
    450  exec mingetty tty5
    451 </pre>
    452 The <a href="index.html">runit</a> package does not care about utmp records
    453 for getties. You should choose a getty that handles its own utmp and wtmp
    454 records.
    455 Debian's <tt>mingetty</tt> creates its own utmp record.
    456 <h3>An <tt>agetty</tt> run script</h3>
    457 (<i>Slackware Linux 9.0</i>)
    458 <pre>
    459  #!/bin/sh
    460  exec agetty 38400 tty1 linux
    461 </pre>
    462 <h3>A <tt>fgetty</tt> run script</h3>
    463 (<i>Linux</i>)
    464 <pre>
    465  #!/bin/sh
    466  exec chpst -P fgetty tty4
    467 </pre>
    468 The <a href="runsv.8.html">runsv</a> program does not automatically create
    469 a new session and separate process group for run scripts, which can
    470 cause some <i>getties</i> to fail due to limited permissions.
    471 The <a href="chpst.8.html">chpst</a> program can be used to alter the
    472 process state for those <i>getties</i>.
    473 <hr>
    474 <h3><a name="gpm">A <tt>gpm</tt> run script</a></h3>
    475 (<i>LFS</i>)
    476 <pre>
    477  #!/bin/sh
    478  exec 2&gt;&amp;1
    479  . /etc/sysconfig/mouse
    480  exec gpm -D -m $MDEVICE -t $PROTOCOL
    481 </pre>
    482 <hr>
    483 <h3><a name="hotwayd">A <tt>hotwayd</tt> run script</a></h3>
    484 (<i>LFS</i>)
    485 <pre>
    486  #!/bin/sh
    487  exec 2&gt;&amp;1
    488  exec tcpsvd -l0 -u nobody 127.0.0.1 110 hotwayd
    489 </pre>
    490 <hr>
    491 <h3><a name="identd">An <tt>oidentd</tt> run script</a></h3>
    492 (<i>Linux</i>, oidentd version 2.0.6)
    493 <pre>
    494  #!/bin/sh
    495  exec 2&gt;&amp;1
    496  exec oidentd -i -S -t 10 -u daemon -g daemon
    497 </pre>
    498 This service needs a
    499 <a href="faq.html#createlog">log service</a>
    500 to be set up.
    501 <p>
    502 (<i>Debian</i>)
    503 <pre>
    504  #!/bin/sh
    505  exec /usr/local/sbin/oidentd --nosyslog -i -u ident -g ident -l 15 -m \
    506    -C /etc/oidentd/oidentd.conf 2&gt;&amp;1
    507 </pre>
    508 This service needs a
    509 <a href="faq.html#createlog">log service</a>
    510 to be set up.
    511 <hr>
    512 <h3><a name="inn">An <tt>innd</tt> run script</a></h3>
    513 (<i>Linux</i>)
    514 <pre>
    515  #!/bin/sh
    516  MEM="`head -1 ./env/MEM`"
    517  exec softlimit -m "${MEM}" \
    518    setuidgid news \
    519    /usr/sw/bin/news/inndstart -f -r
    520 </pre>
    521 <hr>
    522 <h3><a name="jabberd"><tt>jabberd</tt> run scripts</a></h3>
    523 (<i>RedHat 7</i>)
    524 <pre>
    525  #!/bin/sh
    526  exec 2&gt;&amp;1
    527  if [ -f /usr/local/jabber/jabber.pid ]; then
    528    rm /usr/local/jabber/jabber.pid
    529  fi
    530  exec setuidgid jabberd \
    531    /usr/local/jabber/jabberd/jabberd -D -c /etc/jabber.xml
    532 </pre>
    533 This service needs a
    534 <a href="faq.html#createlog">log service</a>
    535 to be set up.
    536 <pre>
    537  #!/bin/sh
    538  exec 2&gt;&amp;1
    539  sleep 5 # so that jit starts after jabberd is up
    540  exec setuidgid jabberd \
    541    /usr/local/jabber/jit/jabberd/jabberd -c /etc/jit.xml
    542 </pre>
    543 This service needs a
    544 <a href="faq.html#createlog">log service</a>
    545 to be set up.
    546 <hr>
    547 <h3><a name="junkbuster">A <tt>junkbuster</tt> run script</a></h3>
    548 (<i>Debian sarge</i>)
    549 <pre>
    550  #!/bin/sh
    551  exec 2&gt;&amp;1
    552  DAEMON=junkbuster
    553  exec "$DAEMON" /etc/junkbuster/config
    554 </pre>
    555 <hr>
    556 <h3><a name="kdm">A <tt>kdm</tt> run script</a></h3>
    557 (<i>Debian sid</i>, <i>FreeBSD 5.3-REL</i>)
    558 <pre>
    559  #!/bin/sh
    560  sv start /service/getty-* || exit 1
    561  exec kdm -nodaemon
    562 </pre>
    563 <hr>
    564 <h3><a name="keepalived">A <tt>keepalived</tt> run script</a></h3>
    565 (<i>Linux</i>)
    566 <pre>
    567  #!/bin/sh
    568  exec 2&gt;&amp;1
    569  exec keepalived -n
    570 </pre>
    571 <hr>
    572 <h3><a name="klogd">A <tt>klogd</tt> run script</a></h3>
    573 (<i>Debian woody</i>)
    574 <pre>
    575  #!/bin/sh
    576  exec klogd -n
    577 </pre>
    578 <hr>
    579 <h3><a name="leafnode">A <tt>leafnode</tt> run script</a></h3>
    580 (<i>Linux</i>)
    581 <pre>
    582  #!/bin/sh
    583  exec 2&gt;&amp;1
    584  exec envuidgid news \
    585    tcpserver -v -x rules.cdb -c 10 -U 0 119 \
    586    leafnode
    587 </pre>
    588 This service needs a
    589 <a href="faq.html#createlog">log service</a>
    590 to be set up.
    591 <hr>
    592 <h3><a name="loglinuxkernel">
    593 A run script for <tt>logging Linux kernel messages with multilog</tt></a></h3>
    594 (<i>Linux</i>)
    595 <pre>
    596  #!/bin/sh -e
    597  exec &lt; /proc/kmsg \
    598  setuidgid loguser \
    599  multilog t n64 ./main
    600 </pre>
    601 <hr>
    602 <h3><a name="mdadm">A <tt>mdadm</tt> run script</a></h3>
    603 (<i>Debian sarge</i>)
    604 <pre>
    605  #!/bin/sh
    606  DEBIANCONFIG=/etc/default/mdadm
    607  MAIL_TO=root
    608  test -f $DEBIANCONFIG && . $DEBIANCONFIG
    609  exec mdadm --monitor --scan --mail $MAIL_TO
    610 </pre>
    611 <hr>
    612 <h3><a name="minidentd">A <tt>minidentd</tt> run script</a></h3>
    613 (<i>Linux</i>)
    614 <pre>
    615  #!/bin/sh
    616  exec 2&gt;&amp;1
    617  exec envuidgid nobody \
    618    tcpserver -vUR 0 113 \
    619    timeoutafter 60 \
    620    minidentd -v
    621 </pre>
    622 This service needs a
    623 <a href="faq.html#createlog">log service</a>
    624 to be set up.
    625 <hr>
    626 <h3><a name="mpd">A <tt>mpd</tt> run script</a></h3>
    627 (<i>Debian sid</i>, <i>FreeBSD 5.3-REL</i>)
    628 <pre>
    629  #!/bin/sh
    630  MPDCONF=/etc/mpd.conf
    631  exec mpd --stdout --no-daemon $MPDCONF
    632 </pre>
    633 This service needs a
    634 <a href="faq.html#createlog">log service</a>
    635 to be set up.
    636 <hr>
    637 <h3><a name="nscd">A <tt>nscd</tt> run script</a></h3>
    638 (<i>Debian sarge</i>)
    639 <pre>
    640  #!/bin/sh
    641  secure=""
    642  for table in passwd group
    643    do
    644      if egrep '^'$table':.*nisplus' /etc/nsswitch.conf >/dev/null
    645        then
    646          nscd_nischeck $table || secure="$secure -S $table,yes"
    647      fi
    648  done
    649  exec nscd -d -- $secure
    650 </pre>
    651 <hr>
    652 <h3><a name="ntpd">A <tt>ntpd</tt> run script</a></h3>
    653 (<i>Linux</i>)
    654 <pre>
    655  #!/bin/sh
    656  MEM=`head -1 ./env/MEM`
    657  exec softlimit -m "${MEM}" \
    658    ntpd -n
    659 </pre>
    660 (<i>OpenNTPD on OpenBSD/Linux</i>)
    661 <pre>
    662  #!/bin/sh
    663  exec /usr/sbin/ntpd -s -d 2>&1
    664 </pre>
    665 This service needs a
    666 <a href="faq.html#createlog">log service</a>
    667 to be set up.
    668 <hr>
    669 <h3><a name="nullidentd">A <tt>nullidentd</tt> run script</a></h3>
    670 (<i>Debian sarge</i>)
    671 <pre>
    672  #!/bin/sh
    673  exec 2&gt;&amp;1
    674  exec tcpsvd -u nobody -x nullidentd-cdb -t 60 0 113 nullidentd
    675 </pre>
    676 This service needs a
    677 <a href="faq.html#createlog">log service</a>
    678 to be set up.
    679 <hr>
    680 <h3><a name="polipo">A <tt>polipo</tt> run script</a></h3>
    681 (<i>Linux</i>)
    682 <pre>
    683  #!/bin/sh
    684  exec 2&gt;&amp;1
    685  exec setuidgid polipo \
    686    polipo -c config forbiddenFile="`pwd`"/forbidden diskCacheRoot="`pwd`"/cache
    687 </pre>
    688 This service needs a
    689 <a href="faq.html#createlog">log service</a>
    690 to be set up.
    691 <hr>
    692 <h3><a name="pop3-ssl">A <tt>pop3-ssl</tt> run script</a></h3>
    693 (<i>BSD</i>)
    694 <pre>
    695  #!/bin/sh
    696  exec tcpserver -R -v -c 50 0 995 /usr/local/sbin/stunnel
    697  -f  -p /etc/ssl/stunnel.pem \
    698  -l /var/qmail/bin/qmail-popup -- /var/qmail/bin/qmail-popup
    699  "`cat /var/qmail/control/me`" vchkpw /var/qmail/bin/qmail-pop3d Maildir 2&gt;&amp;1
    700 </pre>
    701 This service needs a
    702 <a href="faq.html#createlog">log service</a>
    703 to be set up.
    704 <hr>
    705 <h3><a name="pop3vscan">A <tt>pop3vscan</tt> run script</a></h3>
    706 (<i>RedHat 7</i>)
    707 <pre>
    708  #!/bin/sh
    709  exec 2&gt;&amp;1
    710  exec setuidgid pop3vscan pop3vscan -d
    711 </pre>
    712 This service needs a
    713 <a href="faq.html#createlog">log service</a>
    714 to be set up.
    715 <hr>
    716 <h3><a name="portmap">A <tt>portmap</tt> run script</a></h3>
    717 (<i>LFS</i>, <i>Debian sarge</i>)
    718 <pre>
    719  #!/bin/sh
    720  exec 2&gt;&amp;1
    721  exec portmap -d
    722 </pre>
    723 <hr>
    724 <h3><a name="postgresql">A <tt>postgresql</tt> run script</a></h3>
    725 (<i>Debian</i>, <i>SunOS</i>)
    726 <pre>
    727  #!/bin/sh
    728  exec setuidgid postgres /usr/lib/postgresql/bin/postmaster \
    729    -D /var/lib/postgres/data 2&gt;&amp;1
    730 </pre>
    731 This service needs a
    732 <a href="faq.html#createlog">log service</a>
    733 to be set up.
    734 <hr>
    735 <h3><a name="powernowd">A <tt>powernowd</tt> run script</a></h3>
    736 (<i>Debian</i>)
    737 <pre>
    738  #!/bin/sh
    739  set -e  # barf if modprobe fails
    740  modprobe cpufreq-userspace
    741  test ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ||
    742    exec /usr/sbin/powernowd -d
    743  
    744  echo "required sysfs objects not found!"
    745  echo "Read /usr/share/doc/powernowd/README.Debian for more information."
    746  sv down "$(pwd)"
    747 </pre>
    748 <hr>
    749 <h3><a name="ppp">A <tt>ppp</tt> run script</a></h3>
    750 (<i>FreeBSD</i>)
    751 <pre>
    752  #!/bin/sh
    753  exec 2&gt;&amp;1
    754  echo "ppp -ddial dsl "
    755  exec ppp -unit0 -foreground dsl
    756 </pre>
    757 <h3>A <tt>pppd</tt> run script</h3>
    758 (<i>Linux</i>)
    759 <pre>
    760  #!/bin/sh
    761  exec 2&gt;&amp;1
    762  exec chpst -P pppd call isp nodetach
    763 </pre>
    764 <hr>
    765 <h3><a name="privoxy">A <tt>privoxy</tt> run script</a></h3>
    766 (<i>Debian sarge</i>)
    767 <pre>
    768  #!/bin/sh
    769  exec 2&gt;&amp;1
    770  exec chpst -u privoxy:nogroup privoxy --no-daemon /etc/privoxy/config
    771 </pre>
    772 This service needs a
    773 <a href="faq.html#createlog">log service</a>
    774 to be set up.
    775 <hr>
    776 <h3><a name="proftpd">A <tt>proftpd</tt> run script</a></h3>
    777 (<i>Linux</i>, ProFTPD Version 1.2.8rc1,
    778 configure it to use 'ErrorLog "/dev/stdout"')
    779 <pre>
    780  #!/bin/sh
    781  exec 2&gt;&amp;1
    782  exec proftpd -n -d 1
    783 </pre>
    784 This service needs a
    785 <a href="faq.html#createlog">log service</a>
    786 to be set up.
    787 <hr>
    788 <h3><a name="pure-ftpd">A <tt>pure-ftpd</tt> run script</a></h3>
    789 (<i>Debian woody</i>)
    790 <pre>
    791  #!/bin/sh
    792  exec 2&gt;&amp;1
    793  exec pure-ftpd -a 50 -E -l pam -u 100
    794 </pre>
    795 <hr>
    796 <h3><a name="radiusd">A <tt>radiusd</tt> run script</a></h3>
    797 (<i>Slackware Linux 9.0</i>, cistron radius 1.6.1)
    798 <pre>
    799  #!/bin/sh
    800  exec 2&gt;&amp;1
    801  exec radiusd -f -y -z -lstdout
    802 </pre>
    803 This service needs a
    804 <a href="faq.html#createlog">log service</a>
    805 to be set up.
    806 <hr>
    807 <h3><a name="rmrtg">A <tt>rmrtg</tt> run script</a></h3>
    808 ()
    809 <pre>
    810  #!/bin/sh
    811  MRTGUID=`id -u mrtg`
    812  MRTGGID=`id -g mrtg`
    813  exec 2&gt;&amp;1
    814  exec tcpserver -l 0 -R -H -q \
    815    -u"${MRTGUID}" -g"${MRTGGID}" 0 5660 /home/mrtg/ext/rmrtg
    816 </pre>
    817 <hr>
    818 <h3><a name="rsyncd">A <tt>rsyncd</tt> run script</a></h3>
    819 (<i>SunOS</i>)
    820 <pre>
    821  #!/bin/sh
    822  exec 2&gt;&amp;1
    823  exec softlimit -d 100000000 tcpserver \
    824    -x /pack/rsync/rsync.service/tcp.rsync.cdb -v -c 100 -U -H -l 0 -R \
    825    1.2.3.4 873 nice -2 /pack/rsync/bin/rsync --daemon --no-detach \
    826    --config /pack/rsync/etc/rsyncd.conf
    827 </pre>
    828 This service needs a
    829 <a href="faq.html#createlog">log service</a>
    830 to be set up.
    831 <hr>
    832 <h3><a name="samba">A <tt>smbd</tt> run script</a></h3>
    833 (<i>Linux</i>)
    834 <pre>
    835  #!/bin/sh
    836  PATH="/usr/local/samba/bin"
    837  exec 2&gt;&amp;1
    838  exec smbd -F -S -d3
    839 </pre>
    840 This service needs a
    841 <a href="faq.html#createlog">log service</a>
    842 to be set up.
    843 <h3>A <tt>nmbd</tt> run script</h3>
    844 (<i>Linux</i>)
    845 <pre>
    846  #!/bin/sh
    847  PATH="/usr/local/samba/bin"
    848  exec 2&gt;&amp;1
    849  exec nmbd -F -S -d1
    850 </pre>
    851 This service needs a
    852 <a href="faq.html#createlog">log service</a>
    853 to be set up.
    854 <hr>
    855 <h3><a name="shoutcast">A <tt>shoutcast</tt> run script</a></h3>
    856 (<i>RedHat 7</i>)
    857 <pre>
    858  #!/bin/sh
    859  exec 2&gt;&amp;1
    860  exec setuidgid sc_serv \
    861    /usr/local/sc_serv/bin/sc_serv /etc/sc_serv.conf
    862 </pre>
    863 This service needs a
    864 <a href="faq.html#createlog">log service</a>
    865 to be set up.
    866 <hr>
    867 <h3><a name="spamd">A <tt>spamd</tt> run script</a></h3>
    868 (<i>Debian woody</i>)
    869 <pre>
    870  #!/bin/sh
    871  exec spamd -m 20 -a -H -s stderr 2&gt;&amp;1
    872 </pre>
    873 This service needs a
    874 <a href="faq.html#createlog">log service</a>
    875 to be set up.
    876 <hr>
    877 <h3><a name="squid">A <tt>squid</tt> run script</a></h3>
    878 (<i>Debian woody</i>)
    879 <pre>
    880  #!/bin/sh
    881  exec squid -f ./config -sN
    882 </pre>
    883 <hr>
    884 <h3><a name="sshd">A <tt>sshd</tt> run script</a></h3>
    885 (<i>Debian</i>)
    886 <pre>
    887  #!/bin/sh
    888  exec 2&gt;&amp;1
    889  exec /usr/sbin/sshd -D -e
    890 </pre>
    891 This service needs a
    892 <a href="faq.html#createlog">log service</a>
    893 to be set up.
    894 <hr>
    895 <h3><a name="sshdtcpserver">
    896 A <tt>sshd (under tcpserver)</tt> run script</a></h3>
    897 (<i>Linux</i>, sshd version OpenSSH_3.4p1)
    898 <pre>
    899  #!/bin/sh -e
    900  exec 2&gt;&amp;1
    901  exec \
    902  tcpserver -1vpdl0 -Xxtcp.cdb 0 ssh \
    903  sshd -ief config
    904 </pre>
    905 This service needs a
    906 <a href="faq.html#createlog">log service</a>
    907 to be set up.
    908 <hr>
    909 <h3><a name="statd">A <tt>statd</tt> run script</a></h3>
    910 (<i>Debian woody</i>)
    911 <pre>
    912  #!/bin/sh
    913  exec 2&gt;&amp;1
    914  NEED_LOCKD=yes
    915  if test -f /proc/ksyms; then
    916    # We need to be conservative and run lockd,
    917    # unless we can prove that it isn't required.
    918    grep -q lockdctl /proc/ksyms || NEED_LOCKD=no
    919  fi
    920  if [ "$NEED_LOCKD" = yes ]; then
    921    rpc.lockd
    922  fi
    923  exec rpc.statd -F -d
    924 </pre>
    925 This service needs a
    926 <a href="faq.html#createlog">log service</a>
    927 to be set up.
    928 <h3><a name="mountd">A <tt>mountd</tt> run script</a></h3>
    929 (<i>Debian</i>)
    930 <pre>
    931  #!/bin/sh
    932  sv start portmap statd || exit 1
    933  RPCNFSDCOUNT=8  # Number of servers to be started up by default
    934  RPCMOUNTDOPTS=
    935  
    936  trap '/usr/bin/killall -2 nfsd' 0
    937  trap 'exit 2' 1 2 3 15
    938  
    939  exportfs -r
    940  rpc.nfsd -- $RPCNFSDCOUNT
    941  rpcinfo -u localhost nfs 3 &gt;/dev/null 2&gt;&amp;1 ||
    942    RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3"
    943  exec rpc.mountd -F $RPCMOUNTDOPTS
    944 </pre>
    945 <hr>
    946 <h3><a name="stunnel">A <tt>stunnel</tt> run script</a></h3>
    947 (<i>BSD</i>)
    948 <pre>
    949  #!/bin/sh
    950  exec /usr/local/sbin/stunnel -f -d 1234 -r 25 -v3 -a /etc/ssl/mailcerts 2&gt;&amp;1
    951 </pre>
    952 <hr>
    953 <h3><a name="subversion">A <tt>svnserve</tt> run script</a></h3>
    954 (<i>Debian</i>)
    955 <pre>
    956  #!/bin/sh
    957  exec 2>&1
    958  exec /usr/bin/svnserve -d --foreground
    959 </pre>
    960 <hr>
    961 <h3><a name="swat">A <tt>swat</tt> run script</a></h3>
    962 <pre>
    963  #!/bin/sh
    964  exec 2&gt;&amp;1
    965  exec tcpsvd -l0 127.0.0.1 901 swat
    966 </pre>
    967 <hr>
    968 <h3><a name="syslogd">A <tt>syslogd</tt> run script</a></h3>
    969 (<i>Debian sarge</i>)
    970 <pre>
    971  #!/bin/sh
    972  exec syslogd -n
    973 </pre>
    974 <hr>
    975 <h3><a name="taiclockd">A <tt>taiclockd</tt> run script</a></h3>
    976 <pre>
    977  #!/bin/sh
    978  exec 2&gt;&amp;1
    979  exec setuidgid taiclock /usr/local/clockspeed/bin/taiclockd
    980 </pre>
    981 <hr>
    982 <h3><a name="tmda-ofmipd">A <tt>tmda-ofmipd</tt> run script</a></h3>
    983 (<i>RedHat 7</i>)
    984 <pre>
    985  #!/bin/sh
    986  exec /usr/local/tmda/bin/tmda-ofmipd -f -d -R pop3 -p my.host.name:8025 2&gt;&amp;1
    987 </pre>
    988 This service needs a
    989 <a href="faq.html#createlog">log service</a>
    990 to be set up.
    991 <hr>
    992 <h3><a name="tomcat">A <tt>tomcat</tt> run script</a></h3>
    993 (<i>SunOS</i>)
    994 <pre>
    995  #!/bin/sh
    996  exec 2&gt;&amp;1
    997  exec \
    998  setuidgid apache \
    999  /pack/tomcat/current/bin/catalina.sh run
   1000 </pre>
   1001 <hr>
   1002 <h3><a name="tor">A <tt>tor</tt> run script</a></h3>
   1003 (<i>Debian sarge</i>)
   1004 <pre>
   1005  #!/bin/sh
   1006  exec 2&gt;&amp;1
   1007  exec chpst -P -u debian-tor:debian-tor tor
   1008 </pre>
   1009 <hr>
   1010 <h3><a name="vsftpd">A <tt>vsftpd</tt> run script</a></h3>
   1011 (<i>RedHat 7</i>)
   1012 <pre>
   1013  #!/bin/sh
   1014  exec 2&gt;&amp;1
   1015  exec tcpserver -c30 -Xv -llocalhost \
   1016    -x/etc/tcp.ftp.cdb -uvsftpd -gvsftpd 0 ftp \
   1017      softlimit -d300000 /var/vsftpd/bin/vsftpd
   1018 </pre>
   1019 This service needs a
   1020 <a href="faq.html#createlog">log service</a>
   1021 to be set up.
   1022 <hr>
   1023 <h3><a name="wvdial">A <tt>wvdial</tt> run script</a></h3>
   1024 (<i>Slackware Linux 9.0</i>, the service should have a <tt>down</tt>
   1025 file, use <tt>svc -o /service/wvdial</tt> to bring up a ppp connection)
   1026 <pre>
   1027  #!/bin/sh
   1028  exec 2&gt;&amp;1
   1029  exec wvdial ISP
   1030 </pre>
   1031 This service needs a
   1032 <a href="faq.html#createlog">log service</a>
   1033 to be set up.
   1034 <hr>
   1035 <h3><a name="xdm">A <tt>xdm</tt> run script</a></h3>
   1036 (<i>Linux</i>)
   1037 <pre>
   1038  #!/bin/sh
   1039  sv start /service/vc-* || exit 1
   1040  exec xdm -nodaemon
   1041 </pre>
   1042 <hr>
   1043 <h3><a name="xfs">A <tt>xfs</tt> run script</a></h3>
   1044 (<i>Debian sarge</i>)
   1045 <pre>
   1046  #!/bin/sh
   1047  SOCKET_DIR=/tmp/.font-unix
   1048  mkdir -p $SOCKET_DIR
   1049  chown 0:0 $SOCKET_DIR
   1050  chmod 1777 $SOCKET_DIR
   1051  exec /usr/bin/X11/xfs -nodaemon
   1052 </pre>
   1053 <hr>
   1054 <address><a href="mailto:pape@smarden.org">
   1055 Gerrit Pape &lt;pape@smarden.org&gt;
   1056 </a></address>
   1057 </body>
   1058 </html>