make initsg more friendly for local use
Created by: davejrt
This makes initsg friendlier for local dev use and doesn't interfere with .profile
that may otherwise have variables set.
It also switches to use os.create
in order to avoid a list of old tokens being appended to. We no longer have stateless agents and until we do this is a way to ensure we're not continuously appending to a list of envvars.