#! /bin/bash
# Generic respawn

trap '' `seq 0 64`
trap SIGCHLD

VCSBIN=$(type -p vcs)

if [ -n "$VCSBIN" -a  -x "$VCSBIN" ]
then
        status=$?
#echo $status > /tmp/junk
        VCSPID=$(pidof $VCSBIN)
        if [ ! -n "$VCSPID" ]
        then
                [ -f ~/.v-Class-Student/vcsrespawnlock ] || touch ~/.v-Class-Student/vcsrespawnlock
                sleep 1 && exec $VCSBIN
                exit $status
        else
                sleep 1 && exec $0
                exit $status
        fi
else
        kdialog --error "File vcs not found"
fi
