aboutsummaryrefslogtreecommitdiffstats
path: root/www-apps/tt-rss/files/tt-rss.init.d
blob: 3187c147fa50fa55d8c97bc48ddb7f0ec4459cd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
	use net
}

FORKING=${FORKING:-"0"}
PIDFILE=${PIDFILE:-"/var/run/tt-rss.pid"}
PHP=${PHP:-"/usr/bin/php"}
RUNAS=${RUNAS:-"nobody:nobody"}

DAEMON_SCRIPT="update_daemon.php"
if [ "$FORKING" != "0" ]; then
	DAEMON_SCRIPT="update_daemon2.php"
fi

checkconfig() {
	if [ ! -e "${TTRSS_PATH}/${DAEMON_SCRIPT}" ]; then
		eerror "Please set a correct path to the tt-rss installation in /etc/conf.d/tt-rss"
		return 1
	fi
}

start() {
	ebegin "Starting Tiny Tiny RSS update daemon"
	start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --chdir "${TTRSS_PATH}" \
		--user ${RUNAS} --exec ${PHP} --background --make-pidfile -- \
		"${TTRSS_PATH}/${DAEMON_SCRIPT}"

	eend $?
}

stop() {
	ebegin "Stopping Tiny Tiny RSS update daemon"
	start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --user ${RUNAS}
	eend $?
}