#!/bin/bash srv="controller" # insert your server's screen name here bcmd="barrierc -f --no-tray --debug INFO --name $1 --enable-crypto $srv" ssh $1 killall barrierc if ssh $1 pidof barrierc &>/dev/null then ssh $1 killall -9 barrierc fi ssh $1 screen -dmS barrier $bcmd ssh root@$1 renice -n -20 $(ssh $1 pidof barrierc)