parent
db7732fd58
commit
7a264efc82
@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Compcache startup script
|
||||
#
|
||||
# chkconfig: 2345 26 59
|
||||
#
|
||||
# description: Compcache uses part of the RAM as a compressed swap device
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: compcache
|
||||
# Default-Start: 2 3 4 5
|
||||
# Short-Description: Compcache service
|
||||
# Description: Compcache uses part of the RAM as a compressed swap device
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
[ -f /etc/ublinux/services/compcache ] && . /etc/ublinux/services/compcache
|
||||
|
||||
NUM_DEVICES=${NUM_DEVICES:-4}
|
||||
[ -z "$ZRAMSIZE" ] && ZRAMSIZE=$(($(free -b | grep -m1 -i ^mem: | awk '{print $2}') /4))
|
||||
GPRINTF=gprintf
|
||||
[ -f /etc/init.d/functions ] || GPRINTF=log_daemon_msg
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
$GPRINTF "Loading compcache: "
|
||||
/sbin/modprobe zram num_devices=$NUM_DEVICES && \
|
||||
echo $ZRAMSIZE > /sys/block/zram0/disksize && \
|
||||
mkswap /dev/zram0 >/dev/null 2>&1 && \
|
||||
swapon /dev/zram0
|
||||
RETVAL=$?
|
||||
if [ $RETVAL = 0 ]; then
|
||||
log_success_msg $"%s startup" "$base"
|
||||
else
|
||||
log_failure_msg $"%s startup" "$base"
|
||||
fi
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/compcache
|
||||
;;
|
||||
stop)
|
||||
$GPRINTF "Stopping compcache: "
|
||||
test -e /dev/zram0 && swapoff /dev/zram0 && sleep 0.5 && rmmod zram
|
||||
RETVAL=$?
|
||||
if [ $RETVAL = 0 ]; then
|
||||
log_success_msg $"%s stop" "$base"
|
||||
else
|
||||
log_failure_msg $"%s stop" "$base"
|
||||
fi
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/compcache
|
||||
;;
|
||||
status)
|
||||
swapon -s | grep -q /dev/zram0
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart}"
|
||||
RETVAL=1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
@ -1,113 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Polipo Startup script for the NTLM Authorization Proxy Server
|
||||
#
|
||||
# chkconfig: - 95 15
|
||||
# description: NTLMAPS is a proxy-like software, that will authorize you at MS proxy server\
|
||||
# and at web servers (ISS especially) using MS proprietary NTLM authorization method
|
||||
# processname: ntlmaps
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ntlmaps
|
||||
# Required-Start: $local_fs $network $named winbind
|
||||
# Required-Stop: $local_fs $network $named winbind
|
||||
# Short-Description: NTLM Authorization Proxy Server
|
||||
# Default-Start: 3 4 5
|
||||
# Description: NTLMAPS is a proxy-like software, that will authorize you at MS proxy server
|
||||
# and at web servers (ISS especially) using MS proprietary NTLM authorization method.
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Source networking configuration
|
||||
[ -f /etc/ublinux/network ] && . /etc/ublinux/network
|
||||
|
||||
STATUS=status
|
||||
[ -f /etc/init.d/functions ] || STATUS=status_of_proc
|
||||
GPRINTF=gprintf
|
||||
[ -f /etc/init.d/functions ] || GPRINTF=log_daemon_msg
|
||||
|
||||
ntlmaps=${NTLMAPS-/usr/share/ntlmaps/ntlmaps}
|
||||
prog=ntlmaps
|
||||
config=${CONFIG-/etc/ntlmaps.cfg}
|
||||
pidfile=${PIDFILE-/var/run/ntlmaps.pid}
|
||||
lockfile=${LOCKFILE-/var/lock/subsys/ntlmaps}
|
||||
logdir=${LOGDIR-/var/log/ntlmaps}
|
||||
pwddir=$PWD
|
||||
port=5865
|
||||
TIMEOUT=${TIMEOUT-10}
|
||||
RETVAL=0
|
||||
|
||||
|
||||
start() {
|
||||
# Check that networking is up.
|
||||
[ ${NETWORKING} = "no" ] && exit 1
|
||||
[ -x $ntlmaps ] || exit 1
|
||||
[ `id -u` -ne 0 ] && exit 4
|
||||
# check if the config is present
|
||||
[ -f $config ] || exit 6
|
||||
[ -f $pidfile ] && exit 1
|
||||
[ -d $logdir ] || mkdir $logdir
|
||||
chmod 700 $logdir
|
||||
cd $logdir
|
||||
$GPRINTF "Starting ntlmaps: " "$prog"
|
||||
start_daemon $ntlmaps -c $config </dev/null >/dev/null 2>/dev/null &
|
||||
while [ "$TIMEOUT" != "0" ] ;do
|
||||
PRPID=$(/usr/sbin/lsof 2>/dev/null| grep ":$port .LISTEN." | awk '{print $2}')
|
||||
[ -z "$PRPID" ] || break
|
||||
sleep 1
|
||||
TIMEOUT=$(( $TIMEOUT - 1 ))
|
||||
done
|
||||
if [ "$PRPID" = "" ] ;then
|
||||
RETVAL=1
|
||||
log_failure_msg
|
||||
else
|
||||
RETVAL=0
|
||||
log_success_msg
|
||||
touch ${lockfile}
|
||||
echo -ne $PRPID > ${pidfile}
|
||||
fi
|
||||
echo
|
||||
cd $pwddir
|
||||
return $RETVAL
|
||||
}
|
||||
stop() {
|
||||
$GPRINTF "Stopping ntlmaps: " "$prog"
|
||||
PRPID=$(cat $pidfile 2>/dev/null)
|
||||
if [ "$PRPID" = "" ] ;then
|
||||
log_failure_msg
|
||||
else
|
||||
kill $PRPID >/dev/null 2>&1 && log_success_msg || log_failure_msg
|
||||
fi
|
||||
echo
|
||||
rm -f ${lockfile} ${pidfile} 2>/dev/null
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
$STATUS -p ${pidfile} $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
if $STATUS -p ${pidfile} $ntlmaps >&/dev/null; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $prog {start|stop|restart|condrestart|status}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
Loading…
Reference in new issue