Starting tty.js on Boot

I'm trying to start a tty.js shell on boot which is pretty easy with a cron job on boot, but it doesn't start the environment correctly. It doesn't have the right $PATH and such. It is not executing the right scripts like /etc/environment, ~/.bashrc, etc. Is there a way to start tty.js on boot with the same environment when you login.

On Gentoo at least, you set up the environment explicitly using the source /etc/profile command. It resets environment variables and the likes. Give that a try.

For Ubuntu cron jobs at boot and upstart do not load /etc/environment because that is normally done by pam_env.so when you login. However, su does the proper loading of /etc/environment and /etc/profile. So in a cron job at boot or in upstart you could do something like:

exec su username -c "/home/username/bin/tty.js 1> /home/username/tty.log 2> /home/username/tty.log &"