-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dcd37d
commit 5dc07ce
Showing
8 changed files
with
99 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
rm -rf /var/lib/ssh-manager | ||
mkdir -p /var/lib/ssh-manager | ||
|
||
wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ | ||
grep browser_download_url | \ | ||
grep linux-arm64 | \ | ||
awk -F': ' '{print $2}' | \ | ||
tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip | ||
|
||
unzip -j /var/lib/ssh-manager/ssh-manager.zip -d /var/lib/ssh-manager | ||
rm -f /var/lib/ssh-manager/ssh-manager.zip | ||
|
||
SERVICE=$(cat <<-EOF | ||
[Unit] | ||
Description=Central SSH Management Service for AWS Linux EC2 | ||
Wants=network-online.target | ||
After=network-online.target | ||
[Service] | ||
Type=oneshot | ||
ExecStart=/var/lib/ssh-manager/ssh-manager | ||
StandardOutput=journal | ||
User=root | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
) | ||
|
||
echo "$SERVICE" > /etc/systemd/system/ssh-manager.service | ||
|
||
TIMER=$(cat <<-EOF | ||
[Unit] | ||
Description=Timer for Central SSH Management Service | ||
Wants=network-online.target | ||
After=network-online.target | ||
[Timer] | ||
Unit=ssh-manager.service | ||
OnBootSec=1min | ||
OnUnitInactiveSec=60min | ||
Persistent=true | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
) | ||
|
||
echo "$TIMER" > /etc/systemd/system/ssh-manager.timer | ||
|
||
systemctl daemon-reload | ||
systemctl enable ssh-manager.service | ||
systemctl enable --now ssh-manager.timer |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
rm -rf /var/lib/ssh-manager | ||
mkdir -p /var/lib/ssh-manager | ||
|
||
wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ | ||
grep browser_download_url | \ | ||
grep linux-arm64 | \ | ||
awk -F': ' '{print $2}' | \ | ||
tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip | ||
|
||
unzip -j /var/lib/ssh-manager/ssh-manager.zip -d /var/lib/ssh-manager | ||
rm -f /var/lib/ssh-manager/ssh-manager.zip | ||
|
||
(echo "0 * * * * bash -lc '/var/lib/ssh-manager/ssh-manager > /var/lib/ssh-manager/execution.log'") | crontab - |