komodo-modems-update-helper 526 Bytes
#!/bin/bash
set -x

#if [ -z "$2" ]; then
#   echo Invalid arguments
#   exit 1
#fi

[ -d /home/komodo/modems/$1 ] || { echo /home/komodo/modems/$1 does not exits; exit 1; }

# [ -d $2 ] || { echo $2 does not exits; exit 1; }

echo Processing $1
cd /home/komodo/modems/$1 
pwd
echo Pulling for $1
git pull

[ -n "$2" ] && [ -d $2 ] && { 
    rm -rf /home/komodo/modems/$1/node_modules/;
    cp -r $2 /home/komodo/modems/$1
}

[ -f /home/komodo/modems/$1/pid.txt ] && kill `cat /home/komodo/modems/$1/pid.txt`
echo $1 finished