voodoochile Posted May 28, 2009 Posted May 28, 2009 Hello I'm trying to manually compile dansguardian 2.10.0.3 on ubuntu server 9.04 (this version of DG supports blanket block of https by ip address which is what im after not the version on the repo of 2.9.9.7) I cant get it to work .....ive done ./configure - make and make install and it completes with no errors. What happens next ? Do i need to specify additional parameters to the ./configure command line ? How do i get DG to start ? I assume that i need to link some files with the init.d folder ..dunno I'm at a loss where to look next cant seem to find any information anywhere I've always used apt-get to install pre compiled packages in the past Cheers
james_yale Posted May 28, 2009 Posted May 28, 2009 Look for the dansguardian binary (whereis dansguardian), likely in /usr/local/dansguardian/ if you didn't chose anywhere different at the configure step. DG may have installed init scripts, or have sample files included, is there anything in the source tarball you grabbed?
powdarrmonkey Posted May 28, 2009 Posted May 28, 2009 There's a system-v init script included for you: $ sudo cp /usr/local/share/dansguardian/scripts/systemv-init /etc/init.d/dansguardian $ sudo /etc/init.d/dansguardian start You'll also find a log-rotate plugin in there. Of course, make sure you've configured it first, as instructed in the INSTALL file.
voodoochile Posted May 29, 2009 Author Posted May 29, 2009 Hello there Thanks for the pointers in the right direction after running /etc/init.d/dansguardian i get this error "-bash: /etc/init.d/dansguardian: Permission denied" so i changed the permissions the the dansguardian file to excecute run the command again now i get this error "/etc/init.d/dansguardian: 27: Syntax error: "(" unexpected" any ideas ? here is my DG start up script (etc/init.d/dansguardian ), ive not modified anything in the ./configure except --enable-ntlm=yes and the package is dansguardian-2.10.0.3.tar.gz from the dansguardian web site. #!/bin/sh # # Startup script for dansguardian # # chkconfig: 35 92 8 # description: A web content filtering plugin for web \ # proxies, developed to filter using lists of \ # banned phrases, MIME types, filename \ # extensions and PICS labelling. # processname: dansguardian # pidfile: /usr/local/var/run/dansguardian.pid # config: /usr/local/etc/dansguardian/dansguardian.conf ### BEGIN INIT INFO # Provides: dansguardian # Required-Start: squid # Should-Start: # Required-Stop: squid # Should-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Dansguardian web content filter # Description: Dansguardian web content filter ### END INIT INFO # File includes changes by Thomas Jarosch function wait_for_pid() { local PID=$1 local RET=0 if [ $PID -eq 0 ] ; then return $RET fi # give 60 secs then KILL local COUNTDOWN=60 while [ -d /proc/${PID} ] && [ $COUNTDOWN -gt 0 ] ; do sleep 1 COUNTDOWN=$[$COUNTDOWN-1] done if [ -d /proc/${PID} ]; then COMMAND=`ps h -o command ${PID}` logger "dansguardian: timeout waiting for PID ${PID}: ${COMMAND}; sending SIGKILL" kill -KILL $PID >/dev/null 2>&1 RET=1 fi return $RET } # See how we were called. case "$1" in start) if [ -f /usr/local/sbin/dansguardian ] && [ -f /usr/local/etc/dansguardian/dansguardian.conf ]; then echo -n "Starting dansguardian: " if /usr/local/sbin/dansguardian 2> /dev/null; then echo -e "\\033[60G\c" echo -e "[ \\033[1;32m\c" echo -e "OK\c" echo -e "\\033[0;39m\c" echo " ]" [ -d /var/lock/subsys ] && touch /var/lock/subsys/dansguardian else echo -e "\\033[60G\c" echo -e "[ \\033[1;31m\c" echo -e "FAILED\c" echo -e "\\033[0;39m\c" echo " ]" fi fi ;; stop) echo -n "Shutting down dansguardian: " WAITPID=0 if [ -f /usr/local/var/run/dansguardian.pid ] ; then WAITPID=`cat /usr/local/var/run/dansguardian.pid` fi if /usr/local/sbin/dansguardian -q 2> /dev/null; then if wait_for_pid $WAITPID ; then echo -e "\\033[60G\c" echo -e "[ \\033[1;32m\c" echo -e "OK\c" echo -e "\\033[0;39m\c" echo " ]" else echo -e "\\033[60G\c" echo -e "[ \\033[1;31m\c" echo -e "FAILED\c" echo -e "\\033[0;39m\c" echo " ]" fi /bin/rm -f /usr/local/var/run/dansguardian.pid /bin/rm -f /tmp/.dguardianipc [ -d /var/lock/subsys ] && /bin/rm -f /var/lock/subsys/dansguardian else echo -e "\\033[60G\c" echo -e "[ \\033[1;31m\c" echo -e "FAILED\c" echo -e "\\033[0;39m\c" echo " ]" fi ;; restart) $0 stop $0 start ;; status) if [ -f /usr/local/sbin/dansguardian ]; then /usr/local/sbin/dansguardian -s fi ;; *) echo "Usage: $0 {start|stop|restart|status}" >&2 ;; esac exit 0 Thanks in advance karl
powdarrmonkey Posted May 29, 2009 Posted May 29, 2009 I'm not a sh master, but I don't think you need the word 'function' on line 22.
voodoochile Posted May 29, 2009 Author Posted May 29, 2009 Hello powdarrmonkey i rem out out function wait_for_pid() on line 22 now i got a different error !!!! root@ubuntu904:/apps/dansguardian-2.10.0.3# /etc/init.d/dansguardian start [: 52: Illegal number: start Cheers Karl
powdarrmonkey Posted May 29, 2009 Posted May 29, 2009 No don't get rid of the whole line, just remove the 'function' keyword.
voodoochile Posted May 29, 2009 Author Posted May 29, 2009 Hello again After just removing function from the line i now get this error......!!! root@ubuntu904:/apps/dansguardian-2.10.0.3# /etc/init.d/dansguardian start Starting dansguardian: -e -e [ -e FAILED-e ] any more ideas or suggestions Cheers Karl
james_yale Posted June 3, 2009 Posted June 3, 2009 I've tried the script and it runs fine for me - have you tried:sh /etc/init.d/dansguardian start?
voodoochile Posted June 4, 2009 Author Posted June 4, 2009 Hello after trying sh /etc/init.d/dansguardian start this appears root@ubuntu904:/apps/dansguardian-2.10.0.3# sh /etc/init.d/dansguardian start Starting dansguardian: -e -e [ -e OK-e ] #to see whats what root@ubuntu904:/apps/dansguardian-2.10.0.3# dansguardian -s Parent DansGuardian pid:14798 root@ubuntu904:/apps/dansguardian-2.10.0.3# dansguardian -v DansGuardian 2.10.0.3 Built with: '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--enable-ntlm=yes' root@ubuntu904:/apps/dansguardian-2.10.0.3# dansguardian is working reboot machine dansguardian not starting up automatically root@ubuntu904:~# dansguardian -s No DansGuardian process found. root@ubuntu904:~# not a clue about this ...whats the -e [ -e OK-e] after running startup ? never seen that before when starting programs Cheers
james_yale Posted June 4, 2009 Posted June 4, 2009 The extra output you're seeing is probably down to this part of the code: echo -e "\\033[60G\c" echo -e "[ \\033[1;32m\c" echo -e "OK\c" echo -e "\\033[0;39m\c" echo " ]" It's printing the '-e' which should be read as an argument to the echo command. This might be related to why your shell can't run the script, you can find which shell you're using by:echo $SHELL As the script works when executed manually with sh (bash [it's a bash script]) it is correct and working, to make it execute on boot you'll have to generate init scripts to bring the service up, for that you use update-rc.d. update-rc.d dansguardian defaults
voodoochile Posted June 5, 2009 Author Posted June 5, 2009 Hello there thanks to james_yale and powdarrmonkey i now have my dansguardian up and running and booting on startup.....phew!!! before i waste another couple of days of my life ........ can you give me some clues as how to set up log rotation for dansguardian access logs please Cheers and thanks again
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now