script generating player offset files
This commit is contained in:
19
host.d/config.d/mayhem-party.d/remap.d/rotate.sh
Normal file
19
host.d/config.d/mayhem-party.d/remap.d/rotate.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#! /bin/bash
|
||||
|
||||
mayhem_party_rotate() {
|
||||
local currently=$(realpath live.yaml | grep -o '[0-9].yaml$' | grep -o '^[0-9]')
|
||||
local next=${NEXT:-$((RANDOM%5))}
|
||||
while [ -z "$NEXT" ] && [ "$next" == "$currently" ]; do
|
||||
next=$((RANDOM%5))
|
||||
done
|
||||
rm live.yaml
|
||||
ln -s players_offset_$next.yaml live.yaml
|
||||
pkill -SIGUSR1 -f mayhem-party
|
||||
}
|
||||
|
||||
if [ "$0" == "$BASH_SOURCE" ]; then
|
||||
NEXT=0 mayhem_party_rotate
|
||||
while read -p "$(date) > [press enter to rotate]"; do
|
||||
mayhem_party_rotate
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user