#!/bin/bash
if [ -x /usr/bin/curl ]; then
  /usr/bin/curl -o /dev/null -H 'Content-Type: text/plain' --noproxy \* --silent 'http://foreman.example.com/unattended/built'
elif [ -x /usr/bin/wget ]; then
  /usr/bin/wget -q -O /dev/null --method POST --header 'Content-Type: text/plain' --no-proxy 'http://foreman.example.com/unattended/built'
else
  wget -q -O /dev/null --header 'Content-Type: text/plain' 'http://foreman.example.com/unattended/built'
fi

if [ -x "$(command -v subscription-manager)" ] ; then
  subscription-manager facts --update
fi

PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH shutdown -r +1
