#!/sbin/runscript PID_DIR=/var/run/copyconsole depend() { need localmount net after bootmisc } start() { local tmpnice="${NICE:+"--nicelevel "}${NICE}" local tmpionice="${IONICE:+"--ionice "}${IONICE}" local started="" mkdir -p ${PID_DIR} ebegin "Starting copyconsole" for dbuser in ${COPY_USERS}; do local homedir=$(eval echo ~${dbuser}) local pidfile=${PID_DIR}/${dbuser}.pid if test -d "${homedir}" && \ start-stop-daemon -S -b \ ${tmpnice} ${tmpionice} \ -u ${dbuser} -v \ -e HOME=${homedir} \ -m -p ${pidfile} \ -x /opt/bin/copyconsole; then started="${started} ${dbuser}" else eend $? eerror "Failed to start copyconsole for ${dbuser}" if [ -n "${started}" ]; then eerror "Stopping already started copyconsole" COPY_USERS=${started} stop fi return 1 fi done if [ -z "${started}" ];then eerror "No copyconsole started" eend 1 else eend 0 fi } status() { for dbuser in ${COPY_USERS}; do local pidfile=${PID_DIR}/${dbuser}.pid if [ -e ${pidfile} ] ; then echo "copyconsole for USER $dbuser: running." else echo "copyconsole for USER $dbuser: not running." fi done }