1#!/bin/bash 2## BEGIN INIT INFO 3# Provides: sandbox 4# Default-Start: 3 4 5 5# Default-Stop: 0 1 2 3 4 6 6# Required-Start: 7# 8## END INIT INFO 9# sandbox: Set up / mountpoint to be shared, /var/tmp, /tmp, /home/sandbox unshared 10# 11# chkconfig: 345 1 99 12# 13# description: sandbox, xguest and other apps that want to use pam_namespace \ 14# require this script be run at boot. This service script does \ 15# not actually run any service but sets up: \ 16# / to be shared by any app that starts a separate namespace 17# If you do not use sandbox, xguest or pam_namespace you can turn \ 18# this service off.\ 19# 20 21# Source function library. 22. /etc/init.d/functions 23 24LOCKFILE=/var/lock/subsys/sandbox 25 26base=${0##*/} 27 28start() { 29 echo -n "Starting sandbox" 30 31 [ -f "$LOCKFILE" ] && return 0 32 33 touch $LOCKFILE 34 mount --make-rshared / || return $? 35 return 0 36} 37 38stop() { 39 echo -n "Stopping sandbox" 40 41 [ -f "$LOCKFILE" ] || return 1 42} 43 44status() { 45 if [ -f "$LOCKFILE" ]; then 46 echo "$base is running" 47 else 48 echo "$base is stopped" 49 fi 50 exit 0 51} 52 53case "$1" in 54 restart) 55 start && success || failure 56 ;; 57 58 start) 59 start && success || failure 60 echo 61 ;; 62 63 stop) 64 stop && success || failure 65 echo 66 ;; 67 68 status) 69 status 70 ;; 71 72 *) 73 echo $"Usage: $0 {start|stop|status|restart}" 74 exit 3 75 ;; 76esac 77