check for interactive session and /var/www/

Moved the apache restart around and added a check for /var/www. 
Additionally checked for an interactive session before running the screen commands.