Skip to content

Instantly share code, notes, and snippets.

@ceremcem
Created April 21, 2016 22:50
Show Gist options
  • Save ceremcem/f8f943bce072c16a0cb28d64546667c6 to your computer and use it in GitHub Desktop.
Save ceremcem/f8f943bce072c16a0cb28d64546667c6 to your computer and use it in GitHub Desktop.

Add following lines to /etc/rc.local:

USER="myusername"
su ${USER} -c '/home/${USER}/apps/run'

Place a file at /home/myusername/apps/run with the following content:

#/bin/bash 

SESSION="apps"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR

AVAILABLE_WINDOW=1
run-in-tmux() {
    tmux new-window -t ${SESSION}:${AVAILABLE_WINDOW}
    tmux send-keys -t ${SESSION}:${AVAILABLE_WINDOW} "$*" C-m
    AVAILABLE_WINDOW=$((${AVAILABLE_WINDOW}+1))
}

tmux start-server
tmux new-session -d -s ${SESSION}
run-in-tmux 'cd wifi-232-demo; ./tcp-server.py'
run-in-tmux 'cd aktos-scada-live; make production-run-server'
run-in-tmux 'cd aktos-scada-live/tools; python broker.py'
run-in-tmux 'cd aktos-scada-live/tools; python virtual-io-server.py'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment