Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/pkg/bin/bash
- #
- # mysticpage - (c) by Thiesi, 2019
- ### Adjust the following variables to suit your need.
- ### Numbers smaller than 5 for DelayBetweenPagingMessages might not emit another beep.
- ### OnScreenMessageWaitingTime determines how long the script pauses before
- ### moving on after displaying a message to the BBS user.
- NumberOfPagingMessages=6
- DelayBetweenPagingMessages=5
- OnScreenMessageWaitingTime=3
- if [[ $# -eq 2 ]]; then
- SysOpName=$1
- PagingUser=$2
- else
- echo "SYNTAX: mysticpage <SysOp name> <name of paging user>"
- sleep $OnScreenMessageWaitingTime
- exit
- fi
- echo -ne "Please enter a reason for paging: "
- read -e ReasonForPaging
- if [ -z "$ReasonForPaging" ]; then
- ReasonForPaging="*** no reason given ***"
- fi
- PageSysOp()
- {
- echo -e "Incoming chat request from BBS user $PagingUser.\nThey stated the following reason for paging: $ReasonForPaging" | write $SysOpName $tty 2> /dev/null
- }
- tty=(`w -hi $SysOpName | awk '{ print $2 }' | grep -v TTY`)
- if [ $? != 0 ]; then
- echo "Sorry, but the SysOp is currently unavailable. Please try again later."
- sleep $OnScreenMessageWaitingTime
- exit
- else
- echo -ne "Paging SysOp for approximately `expr $NumberOfPagingMessages '*' $DelayBetweenPagingMessages` seconds now..."
- for ((i=0;i<$NumberOfPagingMessages;i++))
- do
- echo -ne "."
- PageSysOp
- if [ $? != 0 ]; then
- echo -e "\nSorry, but the SysOp is busy at the moment. Please try again later."
- sleep $OnScreenMessageWaitingTime
- exit
- fi
- echo -ne "."
- sleep $DelayBetweenPagingMessages
- done
- echo "...done."
- echo "The SysOp has been notified and might engage chat."
- echo "You may continue using the BBS normally."
- sleep $OnScreenMessageWaitingTime
- fi
Advertisement
Add Comment
Please, Sign In to add comment