-
-
Save trendels/b72b8ebd87fabaddd27fa6ad5b859541 to your computer and use it in GitHub Desktop.
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 | |
set -eu -o pipefail | |
echo "###########################################################################" | |
echo "# Uninstalling nginx and removing the log directory to have a clean state." | |
echo "###########################################################################" | |
echo -n "Press Enter to continue, or Ctrl-C to exit. " | |
read answer | |
systemctl stop nginx || true | |
dnf remove -y nginx | |
rm -rf /var/log/nginx | |
echo "###########################################################################" | |
echo "# Installing nginx and starting the nginx service." | |
echo "###########################################################################" | |
echo -n "Press Enter to continue, or Ctrl-C to exit. " | |
read answer | |
dnf install -y nginx | |
systemctl start nginx | |
echo "###########################################################################" | |
echo "# Making an HTTP request to localhost." | |
echo "###########################################################################" | |
curl --silent http://localhost/ > /dev/null | |
echo "###########################################################################" | |
echo "# Listing the log files in /var/log/nginx" | |
echo "###########################################################################" | |
echo -n "Press Enter to continue, or Ctrl-C to exit. " | |
read answer | |
ls -lha /var/log/nginx/ | |
echo "###########################################################################" | |
echo "# Running logrotate" | |
echo "###########################################################################" | |
logrotate -f /etc/logrotate.conf 2>/dev/null || true | |
echo "###########################################################################" | |
echo "# Making another HTTP request to localhost." | |
echo "###########################################################################" | |
curl --silent http://localhost/ > /dev/null | |
echo "###########################################################################" | |
echo "# Listing the log files in /var/log/nginx" | |
echo "###########################################################################" | |
echo -n "Press Enter to continue, or Ctrl-C to exit. " | |
read answer | |
ls -lha /var/log/nginx/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment