junkman690 33679a2bad Update wol
Update 98-rffmpeg

Squash all commits

Update README.md

Update Dockerfile

update maintainer

Delete Dockerfile.complex

Delete root/etc/services.d/sshvpn directory

Create 98-rffmpeg

Initial init script for rffmpeg

Update BuildImage.yml

Update README.md

Update 98-rffmpeg

Move rffmpeg.yml to config dir

Update README.md

Update 98-rffmpeg

Update 98-rffmpeg

Update README.md

Update README.md

Update 98-rffmpeg

Create 95-apt-get

Update 98-rffmpeg

Update README.md

Update README.md

Update 98-rffmpeg

Update 98-rffmpeg

Update 98-rffmpeg

Fix SED statements

Fix if statements

Update README.md

Update README.md

Update README.md

Update 98-rffmpeg

Create wol

Update 98-rffmpeg

Add WOL support

Update wol

Update wol

Add native and WOL API

Update wol

Update README.md

Update README.md

Update README.md

Update wol

Update 98-rffmpeg

Update README.md

Update README.md

Update wol

Update 98-rffmpeg

add +x to wol

Update 98-rffmpeg

Fix ssh permissions

Update 98-rffmpeg

add ping to api wol support

Update README.md

Update wol

Update README.md

Update README.md

Update README.md

Update README.md

Update README.md

Update README.md

Update README.md

Update README.md

Update README.md

Update wol

Update wol

Update README.md

Update README.md
2022-08-18 23:41:18 +10:00

45 lines
1.2 KiB
Bash

#!/usr/bin/bash
mac="${RFFMPEG_HOST_MAC%\"}"
mac="${mac#\"}"
if [ -z $WOL_WAIT ]
then
WOL_WAIT=30
fi
ping -c1 -W1 $RFFMPEG_HOST >/dev/null 2>&1 && host=up || host=down
if [ $RFFMPEG_WOL == "native" ] && [ ! -z $RFFMPEG_HOST ] && [ ! -z $RFFMPEG_HOST_MAC ] && [ ! -z $WOL_WAIT ] && [ $host == "down" ];
then
echo WOL enabled
echo "$RFFMPEG_HOST" is down, sending wakeup to "$mac"
wakeonlan $mac
#wakeonlan -i $RFFMPEG_HOST $mac
echo "waiting $WOL_WAIT seconds for $RFFMPEG_HOST to wake"
sleep $WOL_WAIT
fi
if [ $RFFMPEG_WOL == "api" ] && [ ! -z $RFFMPEG_HOST ] && [ ! -z $RFFMPEG_HOST_MAC ] && [ $host == "down" ] && [ ! -z $WOL_WAIT ] && [ ! -z $WOL_API ] && [ ! -z $WOL_API_PORT ];
then
echo WOL enabled
echo "$RFFMPEG_HOST" is down, sending wakeup via WOL_API: curl -X POST $WOL_API:$WOL_API_PORT/wol/"$mac"
curl -X POST $WOL_API:$WOL_API_PORT/wol/$mac
echo "waiting $WOL_WAIT seconds for $RFFMPEG_HOST to wake"
sleep $WOL_WAIT
fi
if [ ${0##*/} == "ffmpeg" ]
then
#echo ${0##*/}
/usr/local/bin/ffmpeg "$@"
fi
if [ ${0##*/} == "ffprobe" ];
then
#echo ${0##*/}
/usr/local/bin/ffprobe "$@"
fi
exit