#!/bin/sh
# $Id: init,v 1.3 2004/03/16 01:43:45 zal Exp $
#
# Script to remove stale screen named pipes on bootup.
#
set -e

. /lib/lsb/init-functions

SCREENDIR=/var/run/screen

case "$1" in
start)
    if [ ! -d $SCREENDIR ]; then
        mkdir -p $SCREENDIR
	chown root:utmp $SCREENDIR
	chmod 775 $SCREENDIR
    fi
    if find $SCREENDIR -type p | grep '^' >/dev/null; then
        log_begin_msg 'Cleaning up stale screen sessions... '
        find $SCREENDIR -type p -print0 | xargs -0 rm -f
        log_end_msg $?
    fi
    ;;
stop|restart|reload|force-reload)
    ;;
esac

exit 0
