#!/bin/bash
#
# chkconfig: 35 90 12
# description: Iniciador de privoxy
#

# Get function from functions library
#. /etc/init.d/functions

# Start the service FOO
start() {
        #initlog -c "echo -n Starting FOO server: "
		echo "Deteniendo cualquier posible proxy"
		stop
        mkdir /tmp/dmc ;cp -r $HOME/ins /tmp/dmc/ ;cd /tmp/dmc/ins/;sbin/privoxy;cd 
        ### Create the lock file ###
        echo "Levanto el proxy"
        echo
}

# Restart the service FOO
stop() {
        echo "Deteniendo proxy"
        killall privoxy
        ### Now, delete the lock file ###
		echo "Borrando los temporales"
        rm -rf /tmp/dmc 
        echo
}

### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status FOO
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Uso: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0
