source: trunk/debathena/debathena/dotfiles/debian/debathena-dotfiles.init @ 22798

Revision 22798, 1.0 KB checked in by ghudson, 16 years ago (diff)
* debathena/debathena/dotfiles: Copy packs/dotfiles back from the attic and import the Debathena packaging materials. The goal is to simplify this source tree by eliminating multi-OS concerns, but starting from the existing tree seems easiest.
Line 
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides:          athena-sessions-clean
4# Required-Start:    $local_fs
5# Required-Stop:
6# Default-Start:     S
7# Default-Stop:
8# Short-Description: Clean old Athena sessions.
9# Description:       Clean old Athena sessions from /var/run/athena-sessions.
10### END INIT INFO
11
12if [ -e /lib/lsb/init-functions ]; then
13    . /lib/lsb/init-functions
14else
15    alias log_action_begin_msg="echo -n"
16    log_action_end_msg () {
17        echo .
18    }
19fi
20
21clean_athena_sessions () {
22    cd /var/run/athena-sessions || return 1
23    find . -depth -xdev ! -type d \
24        -print0 | xargs -0r rm -f -- \
25        || return 1
26    find . -depth -xdev -type d ! -name . -empty \
27        -exec rmdir \{\} \; \
28        || return 1
29}
30
31case "$1" in
32    start)
33        if ! [ -e /var/run/athena-sessions ]; then
34            mkdir /var/run/athena-sessions
35            chmod a=rwx,u+t /var/run/athena-sessions
36        fi
37        log_action_begin_msg "Cleaning old Athena sessions"
38        clean_athena_sessions
39        log_action_end_msg $?
40        ;;
41    restart|stop|force-reload)
42        ;;
43    *)
44        echo "Usage: $0 {start}" >&2
45        exit 3
46        ;;
47esac
48
49:
Note: See TracBrowser for help on using the repository browser.