#!/bin/sh
# Helper script for launching a driver-specific, backgrounded proxy of a lw
# driver and dumping its pid to a file for compatibility with MCP.
# Usage: isi_lwsm_proxy driver pidfile

DRIVER=$1
PIDFILE=$2
LOG=/var/log/proxy_lwsm_${DRIVER}.log

# Sanity check args
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 driver pidfile" >&2
    exit 1
fi

# Runs 'lwsm proxy driver pidfile'
# Run through the hard link because of kvm naming
daemon /usr/libexec/isilon/${DRIVER} proxy ${DRIVER} ${PIDFILE} >> ${LOG} 2>&1

exit 0
