48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Monitor file $1 for changes
|
|
# Send an alert emai to $2 if file $1 changes
|
|
# usage: ffilewatcher /var/log/messages your.name@domain.com
|
|
#
|
|
|
|
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
|
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
|
|
|
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 "${CS[color,LightGreen]}Filewatcher Installation Script${CS[color,Default]}"
|
|
|
|
do_with_root $APTFUNC -y install inotify-tools
|
|
|
|
do_with_root set -eu
|
|
|
|
do_with_root mkdir /opt/filewatcher
|
|
|
|
do_with_root wget /opt/filewatcher/filewatcher.sh
|
|
|
|
do_with_root ln -s /opt/filewatcher/filewatcher.sh /usr/local/bin/filewatcher
|
|
do_with_root chmod +x /opt/filewatcher/filewatcher.sh
|
|
|
|
|
|
echo ""
|
|
echo -e "${CS[color,LightYellow]}Filewatcher has been Installed${CS[color,Default]}"
|
|
echo ""
|
|
echo -e "To run updates, use the command: ${CS[color,Green]}runup${CS[color,Default]}"
|
|
echo ""
|
|
echo ""
|
|
|
|
exit 0 |