gogs 774 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. pidfile="${gogs_directory}/${name}.pid"
  21. start_cmd="${name}_start"
  22. stop_cmd="${name}_stop"
  23. gogs_start() {
  24. cd ${gogs_directory}
  25. export USER=${gogs_user}
  26. export HOME=/usr/home/${gogs_user}
  27. /usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
  28. }
  29. gogs_stop() {
  30. if [ ! -f $pidfile ]; then
  31. echo "GOGS PID File not found. Maybe GOGS is not running?"
  32. else
  33. kill $(cat $pidfile)
  34. fi
  35. }
  36. run_rc_command "$1"