From 033d6489f856b599f2630b5eacdb0b9a6208e81a Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Thu, 26 Sep 2013 15:58:04 +0000 Subject: [PATCH 1/4] Created OpenRC init script. --- openrc/conf.d/gollum | 3 +++ openrc/init.d/gollum | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 openrc/conf.d/gollum create mode 100644 openrc/init.d/gollum diff --git a/openrc/conf.d/gollum b/openrc/conf.d/gollum new file mode 100644 index 00000000..e5ef8213 --- /dev/null +++ b/openrc/conf.d/gollum @@ -0,0 +1,3 @@ +GOLLUM_USER=gollum +GOLLUM_BASE=/home/gollum/wiki +GOLLUM_OPTS="--config /home/gollum/config.rb" diff --git a/openrc/init.d/gollum b/openrc/init.d/gollum new file mode 100644 index 00000000..235e888c --- /dev/null +++ b/openrc/init.d/gollum @@ -0,0 +1,31 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +NAME=gollum +PID=/var/run/${NAME}.pid + +depend() { + need net +} + +start() { + ebegin "Starting Gollum" + start-stop-daemon --start \ + --name "${NAME}" \ + --user "${GOLLUM_USER}" \ + --pidfile "${PID}" \ + --make-pidfile --background \ + --exec gollum -- $GOLLUM_OPTS "$GOLLUM_BASE" + eend $? +} + +stop() { + ebegin "Stopping Gollum" + start-stop-daemon --stop \ + --name "${NAME}" \ + --user "${GOLLUM_USER}" \ + --pidfile "${PID}" + eend $? +} From 0b57e70c875ff5fb360edb465d7620faa01e62d7 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 27 Sep 2013 14:09:00 +0000 Subject: [PATCH 2/4] Removed explictly set license in OpenRC init script. --- openrc/init.d/gollum | 3 --- 1 file changed, 3 deletions(-) diff --git a/openrc/init.d/gollum b/openrc/init.d/gollum index 235e888c..63292a2e 100644 --- a/openrc/init.d/gollum +++ b/openrc/init.d/gollum @@ -1,7 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ NAME=gollum PID=/var/run/${NAME}.pid From e01aa25be336276bac6611d1c0f6f57e7d805dde Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 27 Sep 2013 17:02:16 +0000 Subject: [PATCH 3/4] Added basic logging to OpenRC script. --- openrc/init.d/gollum | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openrc/init.d/gollum b/openrc/init.d/gollum index 63292a2e..ed815b2b 100644 --- a/openrc/init.d/gollum +++ b/openrc/init.d/gollum @@ -2,19 +2,26 @@ NAME=gollum PID=/var/run/${NAME}.pid +EXEC=/usr/local/bin/gollum +LOG=/var/log/gollum.log depend() { need net } start() { + # Change log file to be owned by GOLLUM_USER + touch "${LOG}" + chown "${GOLLUM_USER}" "${LOG}" + ebegin "Starting Gollum" start-stop-daemon --start \ --name "${NAME}" \ --user "${GOLLUM_USER}" \ --pidfile "${PID}" \ --make-pidfile --background \ - --exec gollum -- $GOLLUM_OPTS "$GOLLUM_BASE" + --stderr "${LOG}" \ + --exec "${EXEC}" -- $GOLLUM_OPTS "$GOLLUM_BASE" eend $? } From cc1231dece2c10f59880fe28bbafe6aee0ca2c77 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Mon, 30 Sep 2013 13:52:34 +0000 Subject: [PATCH 4/4] Added MIT license to init script header. --- openrc/init.d/gollum | 1 + 1 file changed, 1 insertion(+) diff --git a/openrc/init.d/gollum b/openrc/init.d/gollum index ed815b2b..6a5bba14 100644 --- a/openrc/init.d/gollum +++ b/openrc/init.d/gollum @@ -1,4 +1,5 @@ #!/sbin/runscript +# Distributed under the terms of the MIT License NAME=gollum PID=/var/run/${NAME}.pid