#!/usr/bin/env bash # Extracted frm nvidia-xrun DRY_RUN=0 function execute { if [[ ${DRY_RUN} -eq 1 ]] then echo ">>Dry run. Command: $*" else eval $* fi } function turn_off_gpu { if [[ "$REMOVE_DEVICE" == '1' ]]; then echo 'Removing Nvidia bus from the kernel' execute "sudo tee /sys/bus/pci/devices/${DEVICE_BUS_ID}/remove <<<1" else echo 'Enabling powersave for the graphic card' execute "sudo tee /sys/bus/pci/devices/${DEVICE_BUS_ID}/power/control <<