domingo, 19 de febrero de 2012

RPC service with Bash

Xinetd script to execute shell scripts
 #!/bin/bash
function launch {
export params=$*
for pair in $params
do
export name="PARM_`echo $pair|cut -d = -f1`"
export val=`echo $pair|cut -d = -f2`
export $name=$val
done
. $PARM_cmd
}

read uri
export uri=`echo $uri|awk {'print $2'}|cut -d ? -f2`
export script=`echo $uri|cut -d ? -f1`
export param=`echo $uri|cut -d ? -f2`
export paramters=`echo $param|sed 's/&/ /g'`
launch $paramters

No hay comentarios:

Publicar un comentario