You could run as root
env - scriptname
This will clear your environment before running the script, however, it will also keep your
shell. To clear the environment and set the shell to
sh, do the following:
env -i /bin/sh -c scriptname
This will then run the script using
/bin/sh. However, this will not completely simulate the boot environment as this does not count for the other services that may not be running at the time.
I have found a similar question for simulating the crontab environment and there is a very useful solution posted by mmccoo.
Using this you could run this in a script and reboot the host, then use the environment file to load your environment:
part of a boot script:
env > /var/tmp/bootenv
Then at normal runtime to set the same boot environment, do this:
env - `cat /var/tmp/bootenv` /bin/sh -c scriptname