Mayank Chhabra
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
19 additions and
9 deletions
-
karen
|
|
@ -3,6 +3,22 @@ |
|
|
|
# karen watches for signals and executes triggers in the events dir |
|
|
|
# karen gets triggered a lot |
|
|
|
|
|
|
|
check_root () { |
|
|
|
if [[ $UID != 0 ]]; then |
|
|
|
echo "Error: This script must be run as root." |
|
|
|
echo "Can I speak to a manager please?" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
check_if_not_already_running() { |
|
|
|
if ps ax | grep $0 | grep -v $$ | grep bash | grep -v grep |
|
|
|
then |
|
|
|
echo "karen is already running" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
check_dependencies () { |
|
|
|
for cmd in "$@"; do |
|
|
|
if ! command -v $cmd >/dev/null 2>&1; then |
|
|
@ -12,17 +28,11 @@ check_dependencies () { |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
check_root () { |
|
|
|
if [[ $UID != 0 ]]; then |
|
|
|
echo "Error: This script must be run as root." |
|
|
|
echo "Can I speak to a manager please?" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
} |
|
|
|
check_root |
|
|
|
|
|
|
|
check_dependencies fswatch readlink dirname |
|
|
|
check_if_not_already_running |
|
|
|
|
|
|
|
check_root |
|
|
|
check_dependencies fswatch readlink dirname |
|
|
|
|
|
|
|
if [[ -n "$1" ]]; then |
|
|
|
root_dir="$(readlink -f $1)" |
|
|
|