mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Shell scripts are now POSIX compatible, thx @ Johannes Schauer
This commit is contained in:
parent
00824ae2d7
commit
75cc53139e
5 changed files with 16 additions and 16 deletions
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -d "../bin" ]; then
|
if [ -d "../bin" ]; then
|
||||||
cd "../"
|
cd "../"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
type -P node &>/dev/null || {
|
hash node > /dev/null 2>&1 || {
|
||||||
echo "You need to install node!" >&2
|
echo "You need to install node!" >&2
|
||||||
exit 1
|
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
|
echo "You need to install doc.md! npm install -g doc.md" >&2
|
||||||
exit 1
|
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
|
#Move to the folder where ep-lite is installed
|
||||||
FOLDER=$(dirname $(readlink -f $0))
|
FOLDER=$(dirname $(readlink -f $0))
|
||||||
|
@ -10,20 +10,20 @@ if [ -d "../bin" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Stop the script if its started as root
|
#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 "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
|
echo "Use authbind if you want to use a port lower than 1024 -> http://en.wikipedia.org/wiki/Authbind" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Is node installed?
|
#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
|
echo "You need to install node to run Etherpad-Lite!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#Is npm installed?
|
#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
|
echo "You need to install npm to run Etherpad-Lite!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,12 @@ NEEDED_VERSION="1.6.2"
|
||||||
if [ -f "static/js/jquery.min.js" ]; then
|
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]*");
|
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"
|
DOWNLOAD_JQUERY="false"
|
||||||
fi
|
fi
|
||||||
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
|
wget -O static/js/jquery.min.js http://code.jquery.com/jquery-$NEEDED_VERSION.min.js
|
||||||
fi
|
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 need to install node-inspector to run the tests!" >&2
|
||||||
echo "You can install it with npm" >&2
|
echo "You can install it with npm" >&2
|
||||||
echo "Run: npm install node-inspector" >&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
|
#This script ensures that ep-lite is automatically restarting after an error happens
|
||||||
|
|
||||||
|
@ -49,12 +49,12 @@ do
|
||||||
bin/run.sh >>$1 2>>$1
|
bin/run.sh >>$1 2>>$1
|
||||||
|
|
||||||
#Send email
|
#Send email
|
||||||
if [ $ERROR_HANDLING == 1 ]; then
|
if [ $ERROR_HANDLING = 1 ]; then
|
||||||
TIME_NOW=$(date +%s)
|
TIME_NOW=$(date +%s)
|
||||||
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))
|
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))
|
||||||
|
|
||||||
if [ $TIME_SINCE_LAST_SEND -gt $TIME_BETWEEN_EMAILS ]; then
|
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
|
LAST_EMAIL_SEND=$TIME_NOW
|
||||||
fi
|
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 need to install Nodeunit to run the tests!" >&2
|
||||||
echo "You can install it with npm" >&2
|
echo "You can install it with npm" >&2
|
||||||
echo "Run: npm install nodeunit" >&2
|
echo "Run: npm install nodeunit" >&2
|
||||||
|
|
Loading…
Reference in a new issue