b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / etc / rc.d / init.d /
Filename/etc/rc.d/init.d/sandbox
Size1.66 kb
Permissionrwxr-xr-x
Ownerapache
Create time26-May-2024 11:05
Last modified18-Nov-2016 21:00
Last accessed18-Nov-2016 21:00
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
#!/bin/bash
## BEGIN INIT INFO
# Provides: sandbox
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 3 4 6
# Required-Start:
#
## END INIT INFO
# sandbox: Set up / mountpoint to be shared, /var/tmp, /tmp, /home/sandbox unshared
#
# chkconfig: 345 1 99
#
# description: sandbox, xguest and other apps that want to use pam_namespace \
# require this script be run at boot. This service script does \
# not actually run any service but sets up: \
# /var/tmp, /tmp and home directories to be used by these tools.\
# If you do not use sandbox, xguest or pam_namespace you can turn \
# this service off.\
#

# Source function library.
. /etc/init.d/functions

HOMEDIRS="/home"

. /etc/sysconfig/sandbox

LOCKFILE=/var/lock/subsys/sandbox

base=${0##*/}

start() {
echo -n "Starting sandbox"

[ -f "$LOCKFILE" ] && return 1

touch $LOCKFILE
mount --make-rshared / || return $?
mount --rbind /tmp /tmp || return $?
mount --rbind /var/tmp /var/tmp || return $?
mount --make-private /tmp || return $?
mount --make-private /var/tmp || return $?
for h in $HOMEDIRS; do
mount --rbind $h $h || return $?
mount --make-private $h || return $?
done

return 0
}

stop() {
echo -n "Stopping sandbox"

[ -f "$LOCKFILE" ] || return 1
}

status() {
if [ -f "$LOCKFILE" ]; then
echo "$base is running"
else
echo "$base is stopped"
fi
exit 0
}

case "$1" in
restart)
start && success || failure
;;

start)
start && success || failure
echo
;;

stop)
stop && success || failure
echo
;;

status)
status
;;

*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 3
;;
esac