./build/env/bin/hue shell < script.py code example
Example 1: ./build/env/bin/hue shell < script.py
# Promote Hue user to superuser
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
# Example below to run at Hue shell
from django.contrib.auth.models import User
a = User.objects.get(username='gwen')
a.is_superuser = True
a.save()
Example 2: ./build/env/bin/hue shell < script.py
# Change a Hue user password
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue changepassword admin
Example 3: ./build/env/bin/hue shell < script.py
# Set environment variables used to run the Hue webserver:
for line in `strings /proc/$(lsof -i :8888|grep -m1 python|awk '{ print $2 }')/environ|egrep -v "^HOME=|^TERM=|^PWD="`;do export $line;done