4360psufix.sh/rr4360psu_install.sh
2022-04-19 03:45:54 +00:00

32 lines
1.7 KiB
Bash
Executable File

#!/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="https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/-/raw/master/etc/systemd/system/multi-user.target.wants/rr4360psu.service"
get_script="https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/-/raw/master/etc/frontview/support/rr4360psu.sh"
get_timer="https://gitlab.codycook.us/readynas-scripts/4360psufix.sh/-/raw/master/etc/systemd/system/multi-user.target.wants/rr4360psu.timer"
script="/etc/frontview/support/rr4360psu.sh"
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 and starting systemd timer."
systemctl daemon-reload
systemctl enable rr4360psu.timer
systemctl start rr4360psu.timer
echo "First time run."
$script
if [ "$0" == "bash" ] || [ "$0" == "sh" ]; then
echo "Not removing installing. exiting."
else
rm "$0" && echo "Cleaned up installation and exiting."
fi