gogs 817 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. #
  3. # $FreeBSD$
  4. #
  5. # PROVIDE: gogs
  6. # REQUIRE: NETWORKING SYSLOG
  7. # KEYWORD: shutdown
  8. #
  9. # Add the following lines to /etc/rc.conf to enable gogs:
  10. #
  11. #gogs_enable="YES"
  12. . /etc/rc.subr
  13. name="gogs"
  14. rcvar="gogs_enable"
  15. load_rc_config $name
  16. : ${gogs_user:="git"}
  17. : ${gogs_enable:="NO"}
  18. : ${gogs_directory:="/home/git"}
  19. command="${gogs_directory}/gogs web"
  20. procname="$(echo $command |cut -d' ' -f1)"
  21. pidfile="${gogs_directory}/${name}.pid"
  22. start_cmd="${name}_start"
  23. stop_cmd="${name}_stop"
  24. gogs_start() {
  25. cd ${gogs_directory}
  26. export USER=${gogs_user}
  27. export HOME=/usr/home/${gogs_user}
  28. /usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
  29. }
  30. gogs_stop() {
  31. if [ ! -f $pidfile ]; then
  32. echo "GOGS PID File not found. Maybe GOGS is not running?"
  33. else
  34. kill $(cat $pidfile)
  35. fi
  36. }
  37. run_rc_command "$1"