diff --git a/start.sh b/start.sh index f81c281..4e8ecd2 100755 --- a/start.sh +++ b/start.sh @@ -1,6 +1,5 @@ -#!/bin/sh - -echo "Starting kippo in the background...\n" -cd $(dirname $0) -twistd -y kippo.tac -l log/kippo.log --pidfile kippo.pid - +#!/bin/bash +# -*- coding: utf-8, tab-width: 2 -*- +cd "$(readlink -m "$0"/..)" || exit $? +tty --silent && echo 'Starting kippo in the background...' +twistd -y kippo.tac -l log/kippo.log --pidfile kippo.pid || exit $? diff --git a/stop.sh b/stop.sh old mode 100644 new mode 100755 index ab2747f..8ce8537 --- a/stop.sh +++ b/stop.sh @@ -1,12 +1,11 @@ -#!/bin/sh +#!/bin/bash +# -*- coding: utf-8, tab-width: 2 -*- +cd "$(readlink -m "$0"/..)" || exit $? PIDFILE=kippo.pid - -cd $(dirname $0) - -PID=$(cat $PIDFILE 2>/dev/null) +PID=$(LANG=C grep -xPe '[0-9]+' -m 1 "$PIDFILE" 2>/dev/null) if [ -n "$PID" ]; then - echo "Stopping kippo...\n" - kill -TERM $PID + echo 'Stopping kippo...' + kill -TERM "$PID" fi