Skip to content

Commit

Permalink
Updated script installer to make sure that curl and cron are installe…
Browse files Browse the repository at this point in the history
…d. Takes into account SuSE, Debian-based and Red Hat Based OSes
  • Loading branch information
kobaltz committed Feb 8, 2024
1 parent a5d3aa9 commit 8a06cf7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/controllers/mission_control/servers/scripts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ def set_project

def script_content
<<~SCRIPT
if [ "$(id -u)" -eq 0 ]; then
SUDO=""
else
if command -v sudo > /dev/null; then
SUDO="sudo"
else
echo "Script needs to be run as root or with sudo installed."
exit 1
fi
fi
if command -v apt-get > /dev/null; then
$SUDO apt-get update
$SUDO apt-get install -y curl cron
elif command -v yum > /dev/null; then
$SUDO yum install -y curl cronie
elif command -v zypper > /dev/null; then
$SUDO zypper install -y curl cron
else
echo "Unsupported package manager. Please install curl and cron manually."
exit 1
fi
cat <<'EOF' > metrics.sh
#!/bin/bash
Expand Down

0 comments on commit 8a06cf7

Please sign in to comment.