vserverΒΆ

Detect if the server is a Linux-VServer host.

#!/bin/sh

# Test the proc
TEST=`cat /proc/self/status|grep s_context| cut -d":" -f2|cut -d" " -f 2`

case "$TEST" in
  "")
    # Not a vserver kernel
    echo group:host
    ;;
  "0")
    # Vserver kernel but it is the HOST
    echo group:host
    ;;
  [0-9]*)
    # Vserver
    echo group:vserver
    ;;
esac