[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

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

Link to this comparison view

Next revision
Previous revision
howtos:slackware_admin:service [2019/02/21 09:46 (UTC)] – created markandhowtos:slackware_admin:service [2019/02/21 13:22 (UTC)] (current) markand
Line 1: Line 1:
 +<note warning>This document is a draft proposal for a guidelines towards Slackware service files.</note>
 +
 Slackware uses a simple BSD style init script system. Slackware uses a simple BSD style init script system.
  
 Following the Slackware philosophy, init scripts are quite simple and do not perform any kind of black magic. For example, there are no dependencies between init scripts or monitoring. Following the Slackware philosophy, init scripts are quite simple and do not perform any kind of black magic. For example, there are no dependencies between init scripts or monitoring.
  
-In this section we will cover the creation of a usual script. Please follow the template as much as possible, we do like consistency.+In this section we will cover the creation of a usual script. Please follow the template as much as possible for consistency with all scripts.
  
 ====== Style ====== ====== Style ======
Line 29: Line 31:
   * **reload** (optional): do some reload if applicable,   * **reload** (optional): do some reload if applicable,
   * **status** (optional): check wether the service is running.   * **status** (optional): check wether the service is running.
 +
 +Return 1 from the service file if you were unable to perform the operation requested.
  
 ====== Message formats ====== ====== Message formats ======
Line 132: Line 136:
 BIN=/usr/bin/prog BIN=/usr/bin/prog
 CONF=/etc/prog.conf CONF=/etc/prog.conf
-ARGS=-c $CONF+ARGS=-c $CONF -u $USER -g $GROUP
 PID=/var/run/prog.pid PID=/var/run/prog.pid
  
Line 139: Line 143:
   if [ ! -r $CONF ]; then   if [ ! -r $CONF ]; then
     echo "No configuration file available. Aborting"     echo "No configuration file available. Aborting"
-  elif [ -s $PID; then+    exit 1 
 +  fi 
 +   
 +  if [ -s $PID ]; then
     echo "$PRGNAM is already running: $(cat $PID)"     echo "$PRGNAM is already running: $(cat $PID)"
-  elif [ -x $BIN ]; then+    exit 1 
 +  fi 
 +   
 +  if [ -x $BIN ]; then
     echo "Starting $PRGNAM: $BIN $ARGS"     echo "Starting $PRGNAM: $BIN $ARGS"
   fi   fi
Line 183: Line 193:
  ;;  ;;
 *) *)
- echo "usage: $0 {restart|start|status|stop}"+ echo "Usage: $0 {restart|start|status|stop}"
  ;;  ;;
 esac esac
 howtos:slackware_admin:service ()