Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Forked from autumnharmony/ps4-shutdown
Created December 8, 2021 21:41
Show Gist options
  • Save e-minguez/fd9f96544bee030d979b6ed9c442fbce to your computer and use it in GitHub Desktop.
Save e-minguez/fd9f96544bee030d979b6ed9c442fbce to your computer and use it in GitHub Desktop.
ps4 remote shutdown
dependencies:
https://www.npmjs.com/package/ps4-waker
jq
#!/bin/sh
ps4-waker check;
waker_state=$?;
if [ $waker_state -eq 2 ]
then
echo "It already in shutdown state";
exit 0;
else
if [ $waker_state -eq 1 ]
then
echo "It in rest state, need to wake it";
ps4-waker;
fi
fi
JSON=$(ps4-waker check);
RUNNING=$(echo $JSON | jq '."running-app-name"')
if [ -z "$RUNNING" ] || [ "$RUNNING" = "null" ]
then
echo "No running game";
else
echo "Running game, need to close it"
ps4-waker remote ps ps:2000 left left up up up up up up up up up up up up enter enter;
fi;
sleep 5;
echo "Now will try to shutdown it";
ps4-waker remote ps ps:2000 left left up up up up up up up up up up up up down down enter up up up up down down down enter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment