vicendominguez

Simple cgiwrap init script for FreeBSD

May 23rd, 2012
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # $FreeBSD: cgiwrap-fcgi init script v0.5 $
  4. #
  5.  
  6. # PROVIDE: cgiwrap-fcgi
  7. # REQUIRE: LOGIN
  8. # BEFORE:  securelevel
  9. # KEYWORD: shutdown
  10.  
  11. # Add the following lines to /etc/rc.conf to enable `cgiwrap-fcgi':
  12. #
  13. # cgiwrap_fcgi_enable="YES"
  14. # cgiwrap_fcgi_user="user"
  15. #
  16.  
  17. . /etc/rc.subr
  18.  
  19. name="cgiwrap_fcgi"
  20. sockdir="/var/run/cgiwrap-fcgi"
  21. rcvar=`set_rcvar`
  22.  
  23.  
  24. command="/usr/local/bin/cgiwrap-fcgi"
  25. #command_args="&"
  26.  
  27. load_rc_config "$name"
  28. : ${cgiwrap_fcgi_enable="NO"}
  29. : ${cgiwrap_fcgi_user="$(whoami)"}
  30.  
  31. start_cmd="start_cmd"
  32. start_cmd()
  33. {
  34.  
  35.   if [ -n "${sockdir}" ]; then
  36.      mkdir -p ${sockdir} && chown ${cgiwrap_fcgi_user}:${cgiwrap_fcgi_user} ${sockdir}
  37.   fi
  38.   su -m ${cgiwrap_fcgi_user} -c "${command} ${command_args} &"
  39.  
  40. }
  41.  
  42. run_rc_command "$1"
Add Comment
Please, Sign In to add comment