code.gitea.io/gitea@v1.21.7/contrib/init/freebsd/gitea (about)

     1  #!/bin/sh
     2  #
     3  # $FreeBSD$
     4  #
     5  # PROVIDE: gitea
     6  # REQUIRE: NETWORKING SYSLOG
     7  # KEYWORD: shutdown
     8  #
     9  # Add the following lines to /etc/rc.conf to enable gitea:
    10  #
    11  #gitea_enable="YES"
    12  
    13  . /etc/rc.subr
    14  
    15  name="gitea"
    16  rcvar="gitea_enable"
    17  
    18  load_rc_config $name
    19  
    20  : ${gitea_user:="git"}
    21  : ${gitea_enable:="NO"}
    22  : ${gitea_directory:="/var/lib/gitea"}
    23  
    24  command="/usr/local/bin/gitea web -c /etc/gitea/app.ini"
    25  procname="$(echo $command |cut -d' ' -f1)"
    26  
    27  pidfile="${gitea_directory}/${name}.pid"
    28  
    29  start_cmd="${name}_start"
    30  stop_cmd="${name}_stop"
    31  
    32  gitea_start() {
    33  	cd ${gitea_directory}
    34  	export USER=${gitea_user}
    35  	export HOME=/usr/home/${gitea_user}
    36  	export GITEA_WORK_DIR=${gitea_directory}
    37  	/usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command
    38  }
    39  
    40  gitea_stop() {
    41  	if [ ! -f $pidfile ]; then
    42  		echo "GITEA PID File not found. Maybe GITEA is not running?"
    43  	else
    44  		kill $(cat $pidfile)
    45  	fi
    46  }
    47  
    48  run_rc_command "$1"