Shell scripts are now POSIX compatible, thx @ Johannes Schauer
This commit is contained in:
parent
00824ae2d7
commit
75cc53139e
|
@ -1,15 +1,15 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
||||
type -P node &>/dev/null || {
|
||||
hash node > /dev/null 2>&1 || {
|
||||
echo "You need to install node!" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
type -P doc.md &>/dev/null || {
|
||||
hash doc.md > /dev/null 2>&1 || {
|
||||
echo "You need to install doc.md! npm install -g doc.md" >&2
|
||||
exit 1
|
||||
}
|
||||
|
|
12
bin/run.sh
12
bin/run.sh
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
FOLDER=$(dirname $(readlink -f $0))
|
||||
|
@ -10,20 +10,20 @@ if [ -d "../bin" ]; then
|
|||
fi
|
||||
|
||||
#Stop the script if its started as root
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
echo "You shouldn't start Etherpad-Lite as root!" 1>&2
|
||||
echo "Use authbind if you want to use a port lower than 1024 -> http://en.wikipedia.org/wiki/Authbind" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Is node installed?
|
||||
type -P node &>/dev/null || {
|
||||
hash node > /dev/null 2>&1 || {
|
||||
echo "You need to install node to run Etherpad-Lite!" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Is npm installed?
|
||||
type -P npm &>/dev/null || {
|
||||
hash npm > /dev/null 2>&1 || {
|
||||
echo "You need to install npm to run Etherpad-Lite!" >&2
|
||||
exit 1
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ NEEDED_VERSION="1.6.2"
|
|||
if [ -f "static/js/jquery.min.js" ]; then
|
||||
VERSION=$(cat static/js/jquery.min.js | head -n 2 | tail -n 1 | grep -o "v[0-9]*\.[0-9]*\.[0-9]*");
|
||||
|
||||
if [[ ${VERSION:1} = $NEEDED_VERSION ]]; then
|
||||
if [ ${VERSION#v} = $NEEDED_VERSION ]; then
|
||||
DOWNLOAD_JQUERY="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $DOWNLOAD_JQUERY = "true" ]]; then
|
||||
if [ $DOWNLOAD_JQUERY = "true" ]; then
|
||||
wget -O static/js/jquery.min.js http://code.jquery.com/jquery-$NEEDED_VERSION.min.js
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
type -P node-inspector &>/dev/null || {
|
||||
hash node-inspector > /dev/null 2>&1 || {
|
||||
echo "You need to install node-inspector to run the tests!" >&2
|
||||
echo "You can install it with npm" >&2
|
||||
echo "Run: npm install node-inspector" >&2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
#This script ensures that ep-lite is automatically restarting after an error happens
|
||||
|
||||
|
@ -49,12 +49,12 @@ do
|
|||
bin/run.sh >>$1 2>>$1
|
||||
|
||||
#Send email
|
||||
if [ $ERROR_HANDLING == 1 ]; then
|
||||
if [ $ERROR_HANDLING = 1 ]; then
|
||||
TIME_NOW=$(date +%s)
|
||||
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))
|
||||
|
||||
if [ $TIME_SINCE_LAST_SEND -gt $TIME_BETWEEN_EMAILS ]; then
|
||||
echo -e "Server was restared at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 $1)" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS
|
||||
printf "Server was restared at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 $1)" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS
|
||||
|
||||
LAST_EMAIL_SEND=$TIME_NOW
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
type -P nodeunit &>/dev/null || {
|
||||
hash nodeunit > /dev/null 2>&1 || {
|
||||
echo "You need to install Nodeunit to run the tests!" >&2
|
||||
echo "You can install it with npm" >&2
|
||||
echo "Run: npm install nodeunit" >&2
|
||||
|
|
Loading…
Reference in New Issue