Update remote.sh
This commit is contained in:
parent
febb2f3688
commit
89407d63d7
41
remote.sh
41
remote.sh
@ -5,11 +5,23 @@ SSH_USER="username"
|
|||||||
SSH_PASSWORD="password"
|
SSH_PASSWORD="password"
|
||||||
SMARTTV_IP="remote_ip"
|
SMARTTV_IP="remote_ip"
|
||||||
SMARTTV_SCRIPT="python3 smarttv.py"
|
SMARTTV_SCRIPT="python3 smarttv.py"
|
||||||
|
SMARTTV_OPS_REBOOT="sudo reboot"
|
||||||
|
SMARTTV_OPS_AUDIO="pacmd set-default-sink alsa_output.pci-0000_00_1f.3.hdmi-stereo"
|
||||||
|
|
||||||
# Function to execute Python script remotely
|
# Function to execute Python script remotely
|
||||||
execute_remote() {
|
send_command() {
|
||||||
local command="$1"
|
local COMMAND="$1"
|
||||||
sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_SCRIPT $command"
|
sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_SCRIPT" "$COMMAND"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to reboot OPS remotely
|
||||||
|
ops_reboot() {
|
||||||
|
sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_OPS_REBOOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to change the Audio source of the OPS
|
||||||
|
change_ops_audio() {
|
||||||
|
sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_OPS_AUDIO"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if a command is provided
|
# Check if a command is provided
|
||||||
@ -18,5 +30,24 @@ if [ $# -eq 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the function with the provided command
|
# Call the appropriate function based on the provided command
|
||||||
execute_remote "$1"
|
case "$1" in
|
||||||
|
send_command)
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "Usage: $0 send_command <command>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
send_command "$2"
|
||||||
|
;;
|
||||||
|
ops_reboot)
|
||||||
|
ops_reboot
|
||||||
|
;;
|
||||||
|
change_ops_audio)
|
||||||
|
change_ops_audio
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown command: $1"
|
||||||
|
echo "Usage: $0 <send_command|ops_reboot|change_ops_audio> [additional arguments]"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user