Created
October 13, 2015 11:40
-
-
Save alexdebril/1dba3cbdc9421ca70455 to your computer and use it in GitHub Desktop.
bash library to handle multiple scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function launch_script() | |
{ | |
echo "launching ${@:1}" | |
nohup run-process.sh ${@:1} 1>> /tmp/scripts.log 2>>/tmp/crashes.log & | |
} | |
function wait_process() | |
{ | |
echo "waiting" | |
LOCKED=1 | |
while [ $LOCKED -ne 0 ]; do | |
sleep 1 | |
LOCKED=`ls /tmp/processes/lock/ | wc -l` | |
echo . | |
done | |
} | |
ASYNC_PATH="$( cd "$( dirname "$0" )" && pwd )" | |
PATH_OK=`echo $PATH|grep $ASYNC_PATH | wc -l` | |
if [[ ! -x "$ASYNC_PATH/run-process.sh" ]] | |
then | |
echo "turning run-process.sh into an executable" | |
chmod +x $ASYNC_PATH/run-process.sh | |
fi | |
if [[ $PATH_OK -eq 0 ]] | |
then | |
export PATH=$PATH:$ASYNC_PATH | |
echo $PATH | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment