~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/screen-cleanup

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# $Id: init,v 1.3 2004/03/16 01:43:45 zal Exp $
 
3
#
 
4
# Script to remove stale screen named pipes on bootup.
 
5
#
 
6
 
 
7
### BEGIN INIT INFO
 
8
# Provides:          screen-cleanup
 
9
# Required-Start:    $remote_fs
 
10
# Required-Stop:     $remote_fs
 
11
# Default-Start:     S
 
12
# Default-Stop:
 
13
# Short-Description: screen sessions cleaning
 
14
# Description: Cleans up the screen session directory and fixes its
 
15
#  permissions if needed.
 
16
### END INIT INFO
 
17
 
 
18
set -e
 
19
 
 
20
test -f /usr/bin/screen || exit 0
 
21
 
 
22
SCREENDIR=/var/run/screen
 
23
 
 
24
case "$1" in
 
25
start)
 
26
    if test -L $SCREENDIR || ! test -d $SCREENDIR; then
 
27
        rm -f $SCREENDIR
 
28
        mkdir $SCREENDIR
 
29
        chown root:utmp $SCREENDIR
 
30
        [ -x /sbin/restorecon ] && /sbin/restorecon $SCREENDIR
 
31
    fi
 
32
    find $SCREENDIR -type p -delete
 
33
# If the local admin has used dpkg-statoverride to install the screen
 
34
# binary with different set[ug]id bits, change the permissions of
 
35
# $SCREENDIR accordingly
 
36
    BINARYPERM=`stat -c%a /usr/bin/screen`
 
37
    if [ "$BINARYPERM" -ge 4000 ]; then
 
38
        chmod 0755 $SCREENDIR
 
39
    elif [ "$BINARYPERM" -ge 2000 ]; then
 
40
        chmod 0775 $SCREENDIR
 
41
    else
 
42
        chmod 1777 $SCREENDIR
 
43
    fi
 
44
    ;;
 
45
stop|restart|reload|force-reload)
 
46
    ;;
 
47
esac
 
48
 
 
49
exit 0