#!/bin/sh

PROFILES=/etc/terminals

test -d "$PROFILES" || exit 0

start() {

    for f in $(ls -1 "$PROFILES")
    do
        logger -s -p "user.info" -t "$0" "Starting $f"
        /usr/local/bin/terminals/terminal.sh "/etc/terminals/$f" &
    done
}

stop() {
    killall terminal.sh
}


case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|reload)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit $?
