Skip to content

Commit

Permalink
Run tmux only right after sshd/login
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Jaburek <jjaburek@redhat.com>
  • Loading branch information
Jiri Jaburek committed Oct 2, 2019
1 parent c71298a commit 79a74c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# platform = multi_platform_fedora,Red Hat Enterprise Linux 8,Oracle Linux 8

LINE='[ -n "$PS1" -a -z "$TMUX" ] && exec tmux'
if ! tail -1 /etc/bashrc | grep -x "$LINE" ; then
echo "$LINE" >> /etc/bashrc
if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then
cat >> /etc/bashrc <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
fi
EOF
fi

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ ocil_clause: 'exec tmux is not present at the end of bashrc'
ocil: |-
To verify that tmux is configured to execute,
run the following command:
<pre>$ tail -1 /etc/bashrc</pre>
<pre>$ tail -5 /etc/bashrc</pre>
The output should return the following:
<pre>[ -n "$PS1" -a -z "$TMUX" ] &amp;&amp; exec tmux</pre>
<pre>if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
fi</pre>
platform: machine

0 comments on commit 79a74c1

Please sign in to comment.