-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.sh
More file actions
executable file
·28 lines (27 loc) · 946 Bytes
/
tmux.sh
File metadata and controls
executable file
·28 lines (27 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/env sh
find . -type d -name "__pycache__" -exec rm -rf {} +
# Define the session name
sess="tmux-session"
# Check if payment is pending
if [ -f ~/no_payment.lock ]; then
echo "**************************************************"
echo " ACCESS RESTRICTED: Payment Pending"
echo " Please contact the administrator to resume access."
echo "**************************************************"
exit 1
fi
# Check if the session exists
if tmux has-session -t "$sess" 2>/dev/null; then
echo "Session $sess already exists. Attaching to it."
tmux attach -t "$sess"
else
# If the session doesn't exist, create it
echo "updating"
git reset --hard && git pull
echo "Creating and attaching to session $sess."
tmux new-session -d -s "$sess"
tmux send-keys -t "$sess" "cd src" C-m
tmux send-keys -t "$sess" "pwd" C-m
tmux send-keys -t "$sess" "python3 main.py && tmux kill-session -t $sess" C-m
tmux attach -t "$sess"
fi