Skip to content

Commit 238fb8f

Browse files
committed
Fixed scoping of start script
1 parent 8e4cfa8 commit 238fb8f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bin/cpu-daemon

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
#!/bin/sh
22

3-
dir=`dirname "$(readlink "$0")"`
3+
#http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
4+
source="${BASH_SOURCE[0]}"
5+
while [ -h "$source" ]; do # resolve $source until the file is no longer a symlink
6+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
7+
source="$(readlink "$source")"
8+
# if $source was a relative symlink, we need to resolve
9+
#it relative to the path where the symlink file was located
10+
[[ $source != /* ]] && source="$dir/$source"
11+
done
12+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
413

5-
node $dir/../cpu-daemon.js &> $dir/../logs/cpu-daemon.log &
14+
project_dir="$(dirname "$dir")"
15+
16+
node $project_dir/cpu-daemon.js &> $project_dir/logs/cpu-daemon.log &

0 commit comments

Comments
 (0)