26 lines
736 B
Bash
Executable File
26 lines
736 B
Bash
Executable File
#!/bin/bash
|
|
. /etc/default/2smanc
|
|
|
|
[ "$TOKEN" == "" ] && exit
|
|
[ "$GOTIFY" == "" ] && exit
|
|
|
|
case $1 in
|
|
run)
|
|
[ "$(/usr/bin/find /etc/2smanc/enable/ -type l,f | wc -l)" -eq 0 ] && exit
|
|
/usr/bin/wget "${GOTIFY}/message?token=${TOKEN}" --post-data="message=$(/usr/bin/find /etc/2smanc/enable/ -type f,l -exec {} \;| /usr/bin/jq -sr @uri)" -qO - > /dev/null ;;
|
|
list)
|
|
ls /usr/share/2smanc/scripts/
|
|
;;
|
|
active)
|
|
ls /etc/2smanc/enable/
|
|
;;
|
|
enable)
|
|
[ -e "/usr/share/2smanc/scripts/$2" ] && ln -s "/usr/share/2smanc/scripts/$2" "/etc/2smanc/enable/$2" || echo "scripts do not exists in /usr/share/2smanc/scripts/"
|
|
;;
|
|
disable)
|
|
rm -fr /etc/2smanc/enable/$2
|
|
;;
|
|
*)
|
|
echo "2smanc [list|active|run] [enable|disable] <script>"
|
|
esac
|