Passion/bash

tmux in rc.local

sunshout 2020. 3. 2. 22:20

rc.local 을 활용하여 시작 스크립트를 실행할 수 있다.

그 중에서 tmux session을 열고 명령어를 실행하는 방법

/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.

/root/start_kube.sh

exit 0

 

/root/start_kube.sh 스크립트

#!/bin/sh

# starting new tmux session with name 'kube' including one window called 'mon'

tmux new-session -s "kube" -d -n "daemon"
tmux send-keys -t "kube:daemon" C-z 'microk8s.start' Enter