#!/bin/bash accept=${HTTP_ACCEPT,,} language=${HTTP_ACCEPT_LANGUAGE,,} language=${language:0:2} if [ "$accept" != "${accept/application\/json/}" ] ; then echo "Content-type: application/json" echo uptime | sed -r 's/^.*load average: (.*), (.*), (.*)/{"load": {"1": \1, "5": \2, "15": \3}}/;' else if [ "$language" == "de" ] ; then if [ "$accept" != "${accept/text\/html}" ] ; then echo "Content-type: text/html" echo "Content-language: de" echo echo "

load

" echo "

Die 'load' Ressource enthält das Unix-System Lastinformationen für diesen Server.

" echo "

GET ist die einzige gültige Methode.

" echo "

Daten als application/json zurück.

" else echo "Content-type: text/plain" echo "Content-language: de" echo echo "LOAD" echo "Die 'load' Ressource enthält das Unix-System Lastinformationen für diesen Server." echo "GET ist die einzige gültige Methode." echo "Daten als application/json zurück." fi else if [ "$accept" != "${accept/text\/html}" ] ; then echo "Content-type: text/html" echo "Content-language: en" echo echo "

load

" echo "

The 'load' resource contains the unix system load information for this server.

" echo "

GET is the only valid method.

" echo "

Data is returned as application/json.

" else echo "Content-type: text/plain" echo "Content-language: en" echo echo "LOAD" echo "The 'load' resource contains the unix system load information for this server." echo "GET is the only valid method." echo "Data is returned as application/json." fi fi fi