View | Details | Raw Unified | Return to bug 224614 | Differences between
and this patch

Collapse All | Expand All

(-)devel/gogs/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
PORTNAME=	gogs
3
PORTNAME=	gogs
4
DISTVERSIONPREFIX=	v
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	0.11.34
5
DISTVERSION=	0.11.34
6
PORTREVISION=	1
6
PORTREVISION=	2
7
CATEGORIES=	devel www
7
CATEGORIES=	devel www
8
8
9
MAINTAINER=	dg@syrec.org
9
MAINTAINER=	dg@syrec.org
(-)devel/gogs/files/gogs-service.in (-17 / +12 lines)
Lines 26-45 Link Here
26
: ${%%PORTNAME%%_enable="NO"}
26
: ${%%PORTNAME%%_enable="NO"}
27
: ${%%PORTNAME%%_config="%%ETCDIR%%/conf/app.ini"}
27
: ${%%PORTNAME%%_config="%%ETCDIR%%/conf/app.ini"}
28
28
29
logfile=/var/log/%%PORTNAME%%.log
30
pidfile=/var/run/%%PORTNAME%%.pid
31
command="/usr/bin/true"
32
procname="/usr/sbin/daemon"
33
29
is_process_running() {
34
is_process_running() {
30
  local pidfile=$1
35
  [ -f $pidfile ] && procstat $(cat $pidfile) >/dev/null 2>&1
31
  [ -f $pidfile ] && procstat `cat $pidfile` >/dev/null 2>&1
32
}
36
}
33
37
34
stop_daemon() {
35
  # assume PID is also PGID (daemon(8) PID is always PGID)
36
  [ -f "$1" ] && kill -- -$(cat $1)
37
}
38
39
%%PORTNAME%%_start() {
38
%%PORTNAME%%_start() {
40
  local logfile=/var/log/%%PORTNAME%%.log
39
  if is_process_running; then
41
  local pidfile=/var/run/%%PORTNAME%%.pid
42
  if is_process_running $pidfile; then
43
    echo "%%PORTNAME%% is already running (pid=$(cat $pidfile))"
40
    echo "%%PORTNAME%% is already running (pid=$(cat $pidfile))"
44
    return 1
41
    return 1
45
  fi
42
  fi
Lines 49-55 Link Here
49
  chmod 640 $logfile
46
  chmod 640 $logfile
50
  cd %%PREFIX%%/libexec/%%PORTNAME%%
47
  cd %%PREFIX%%/libexec/%%PORTNAME%%
51
  /usr/sbin/daemon -P $pidfile -u %%GOGS_USER%% %%PREFIX%%/libexec/%%PORTNAME%%/%%PORTNAME%% web --config ${%%PORTNAME%%_config} >>$logfile 2>&1
48
  /usr/sbin/daemon -P $pidfile -u %%GOGS_USER%% %%PREFIX%%/libexec/%%PORTNAME%%/%%PORTNAME%% web --config ${%%PORTNAME%%_config} >>$logfile 2>&1
52
  if is_process_running $pidfile; then
49
  if is_process_running; then
53
    echo "started %%PORTNAME%% (pid=$(cat $pidfile))"
50
    echo "started %%PORTNAME%% (pid=$(cat $pidfile))"
54
  else
51
  else
55
    echo "failed to start %%PORTNAME%%"
52
    echo "failed to start %%PORTNAME%%"
Lines 57-71 Link Here
57
}
54
}
58
55
59
%%PORTNAME%%_stop() {
56
%%PORTNAME%%_stop() {
60
  local pidfile=/var/run/%%PORTNAME%%.pid
57
  if is_process_running; then
61
  if is_process_running $pidfile; then
58
    local pid=$(cat $pidfile)
62
    echo "stopping %%PORTNAME%% (pid=$(cat $pidfile))"
59
    echo "stopping %%PORTNAME%% (pid=$pid)"
63
    stop_daemon $pidfile
60
    kill -- -$pid
64
  else
61
  else
65
    echo "%%PORTNAME%% isn't running"
62
    echo "%%PORTNAME%% isn't running"
66
  fi
63
  fi
67
}
64
}
68
65
69
command="/usr/bin/true"
70
71
run_rc_command "$1"
66
run_rc_command "$1"

Return to bug 224614