Now more silent by default to prevent log spam hourly.

Change debug to any value above 0 to enable output.
This commit is contained in:
Cody Cook 2019-06-12 14:50:38 -07:00
commit 598f73ba85
2 changed files with 43 additions and 29 deletions

View file

@ -1,26 +1,31 @@
#!/bin/bash
# Installer for RR4360 PSU fix
# RR4360 PSU reports offline inappropriately and annoys the user.
# This installs persistent service to check, refault to run every hour on the hour.
# to install, `curl https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/raw/master/rr4360psu_install.sh | bash`
# alternatively, `wget https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/raw/master/rr4360psu_install.sh; bash rr4360psu_install.sh`
# alternatively, `wget https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/raw/master/rr4360psu_install.sh; chmod +x rr4360psu_install.sh; ./rr4360psu_install.sh`
# if internet is a problem, download files from below and copy/paste the details into via SSH/SDM/Console.
get_service="http://ntgr.support/scripts/readynas_os_6/rr4360psu.service"
get_script="http://ntgr.support/scripts/readynas_os_6/rr4360psu.sh"
get_timer="http://ntgr.support/scripts/readynas_os_6/rr4360psu.timer"
script="/etc/frontview/support/rr4360psu.sh"
echo "This is the installer for the RR4360 PSU reporting Offline issue."
echo "It installs files in their appropriate locations and then schedules a run at the top of every hour."
echo "Installing systemd components. "
echo "Downloading and installing systemd components."
wget -q "$get_script" -O "$script"
chmod +x "$script"
wget -q "$get_service" -O "/etc/systemd/system/rr4360psu.service"
wget -q "$get_timer" -O "/etc/systemd/system/rr4360psu.timer"
echo "Enabling the systemd timer."
echo "Enabling and starting systemd timer."
systemctl daemon-reload
systemctl enable rr4360psu.timer
systemctl start rr4360psu.timer
echo "Done"
echo "Since this is freshly installed, running for the first time, then removing the installer."
echo "First time run."
$script
if [ "$0" == "bash" ] || [ "$0" == "sh" ]; then
echo "Script ran from STDOUT, cannot remove installer."
echo "Exiting the installation procedure. Cya!"
echo "Not removing installing. exiting."
else
rm "$0" && echo "Removed the installer and exiting the installation procedure. Cya!"
rm "$0" && echo "Cleaned up installation and exiting."
fi