mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
61 lines
1.3 KiB
Bash
61 lines
1.3 KiB
Bash
#!/bin/sh
|
|
|
|
# herriectl
|
|
# This script sends varying signals to all running instances of herrie
|
|
# with the same effective uid as the process running this script
|
|
# The signal sent is based upon the input argument
|
|
# Written by Phillip Warner
|
|
|
|
VERSION=0.1
|
|
|
|
# Signales that correspond to functions
|
|
SPLAY="SIGRTMIN+1"
|
|
SSTOP="SIGRTMIN+2"
|
|
SPAUSE="SIGUSR1"
|
|
SNEXT="SIGUSR2"
|
|
SPREV="SIGRTMIN+3"
|
|
|
|
usage() {
|
|
echo "$(basename $0) $VERSION - by Phillip Warner"
|
|
echo "Usage:"
|
|
echo " $0 [OPTION]"
|
|
echo "Only one parameter can be used at a time."
|
|
echo "The script's parameters are:"
|
|
echo " -h, --help Help"
|
|
echo " -b, --next Play Next"
|
|
echo " -c, --pause Pause"
|
|
echo " -v, --stop Stop"
|
|
echo " -x, --play Play Selected"
|
|
echo " -z, --previous Play Previous"
|
|
echo
|
|
echo "Current herrie PIDs (euid=$(id -u)):"
|
|
pgrep -u $(id -u) herrie$
|
|
}
|
|
|
|
# Make sure there is no more than one arg
|
|
if [ $2 ]
|
|
then
|
|
usage
|
|
elif [ $1 ]
|
|
then
|
|
case $1 in
|
|
-h|--help ) usage
|
|
;;
|
|
-b|--next ) pkill -$SNEXT -u $(id -u) herrie$
|
|
;;
|
|
-c|--pause ) pkill -$SPAUSE -u $(id -u) herrie$
|
|
;;
|
|
-v|--stop ) pkill -$SSTOP -u $(id -u) herrie$
|
|
;;
|
|
-x|--play ) pkill -$SPLAY -u $(id -u) herrie$
|
|
;;
|
|
-z|--previous ) pkill -$SPREV -u $(id -u) herrie$
|
|
;;
|
|
* ) usage
|
|
;;
|
|
esac
|
|
else
|
|
usage
|
|
fi
|
|
|
|
exit
|