Welcome, guest | Sign In | My Account | Store | Cart

There is no trivial way to know what Linux you are running. Red Hat, SuSE, etc., each distribution has a different way to tell what version is installed.

Text, 61 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash

# Set up correctly depending on the distribution
if [ -f /etc/redhat-release ]
then
  # Redhat
  . /etc/init.d/functions

  HTTP_DAEMON_START="/usr/sbin/httpd"

elif [ -f /etc/SuSE-release ]
then
  # SuSE
  . /etc/rc.status

  echo_success()
  {
      rc_reset
      rc_status -v
  }
  echo_failure()
  {
      rc_failed
      rc_status -v
  }

  HTTP_DAEMON_START="/usr/sbin/httpd"

elif [ -f /etc/debian_version ]
then
  # Debian
  echo_success()
  {
      echo success
  }
  echo_failure()
  {
      echo failure
  }

  HTTP_DAEMON_START="start-stop-daemon --start --chuid root --exec /usr/sbin/httpd --"

else
  # Other distos
  echo_success()
  {
      echo success
  }
  echo_failure()
  {
      echo failure
  }

  if [ -f /etc/init.d/functions.sh ]
  then
       . /etc/init.d/functions.sh
       HTTP_DAEMON_START="start-stop-daemon --start --chuid root --exec /usr/sbin/httpd --"
  else
       HTTP_DAEMON_START="/usr/sbin/httpd"
  fi
fi
Created by Gui R on Tue, 3 Mar 2009 (MIT)
Bash recipes (41)
Gui R's recipes (3)

Required Modules

  • (none specified)

Other Information and Tasks