Files
Misc-Scripts/install-filewatcher.sh
2023-05-06 10:11:04 -05:00

45 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ -d /opt/idssys/defaults ]; then
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
else
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
fi
if type apt &>/dev/null; then
ATYPE="apt"
elif type apt-get &>/dev/null; then
ATYPE="apt-get"
elif type yum &>/dev/null; then
ATYPE="yum"
else
ATYPE="unknown"
exit 1
fi
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
else APTFUNC="${ATYPE}"
fi
echo ""
echo -e "${idsCL[LightGreen]}Filewatcher Installation Script${idsCL[Default]}"
do_with_root $APTFUNC -y install inotify-tools
do_with_root set -eu
do_with_root mkdir /opt/filewatcher
cd /opt/filewatcher
do_with_root wget https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/filewatcher.sh
do_with_root chmod +x /opt/filewatcher/filewatcher.sh
do_with_root ln -s /opt/filewatcher/filewatcher.sh /usr/local/bin/filewatcher
echo ""
echo -e "${idsCL[LightYellow]}Filewatcher has been Installed${idsCL[Default]}"
echo ""
echo -e "To run, use the command: ${idsCL[Green]}filewatcher {file_to_watch} {your_email_address}${idsCL[Default]}"
echo ""
echo ""