Last active
January 26, 2023 05:12
-
-
Save crazyboycjr/a09e9eec7f83959ab5f0bfb021c12376 to your computer and use it in GitHub Desktop.
rc.local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=/etc/rc.local compatibility | |
[Service] | |
Type=oneshot | |
ExecStart=/etc/rc.local | |
RemainAfterExit=yes | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# workaround for ip6tables problem | |
ufw disable | |
ufw enable | |
# start user screens | |
su -c "/home/cjr/scripts/screens/screens.sh" - cjr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# su -c "/home/cjr/startup-scripts/rssh/rssh.sh" - cjr | |
set -eu | |
SESSION=rssh | |
USERS=('cjr' 'cjr') | |
HOSTS=('139.162.62.11' '152.136.36.123') | |
WINDOWS=('cjr-server4' 'tencent-cloud') | |
PORTS=('22' '22') | |
MON_PORTS=('13223' '44542') # random ports | |
RSH_OPTS=('22220:localhost:22' '22223:localhost:22') | |
function tmux_init() | |
{ | |
tmux new-session -s $SESSION -n empty -d | |
n=${#HOSTS[@]} | |
for ((i=0;i<$n;i++)); do | |
host=${HOSTS[$i]} | |
port=${PORTS[$i]} | |
window=${WINDOWS[$i]} | |
tmux new-window -t $SESSION -n $window -d | |
done | |
sleep 1 | |
} | |
function do_connect() | |
{ | |
n=${#HOSTS[@]} | |
for ((i=0;i<$n;i++)); do | |
user=${USERS[$i]} | |
host=${HOSTS[$i]} | |
port=${PORTS[$i]} | |
mon_port=${MON_PORTS[$i]} | |
rsh_opt=${RSH_OPTS[$i]} | |
window=${WINDOWS[$i]} | |
pane="${SESSION}:${window}.0" | |
tmux send-keys -t $pane "autossh -M $mon_port -R $rsh_opt -p $port $user@$host" Enter | |
done | |
} | |
tmux_init | |
do_connect | |
printf 'rssh established\n' | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
screen -dmS www | |
sleep 1 | |
screen -S www -X stuff 'cd /home/cjr/Developing/www\n' | |
#screen -S www -X stuff 'docker run -it --rm -p 3000:3000 -v ~/public/:/src/public/ crazyboycjr/www\n' | |
screen -S www -X stuff 'npm start\n' | |
screen -dmS deafbeed | |
sleep 1 | |
screen -S deafbeed -X stuff 'cd /home/cjr/Developing/deafbeed\n' | |
screen -S deafbeed -X stuff 'npm start\n' | |
screen -dmS s3s | |
sleep 1 | |
screen -S s3s -X stuff 'cd /home/cjr/Developing/s3s\n' | |
screen -S s3s -X stuff 'python3 s3s.py -M -r\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment