Ubuntu 14.04.5 LTS
Desired functionality: Remote Ubuntu server boots and automatically starts an ongoing process as a specified user. I can then log in remotely at a later time and view the past and current screen output of the ongoing process.
Current plan:
Automated steps:
User "ubuntu" is logged in automatically to a terminal (TTY) on boot:
"sudo nano /etc/init/tty1.conf" Change: exec /sbin/getty -8 38400 tty1 To: exec /sbin/getty --autologin ubuntu -8 38400 tty1
User "ubuntu" runs GNU screen:
screen -d -m -S screenname
User "ubuntu" runs the ongoing process within GNU screen:
screen -S screenname -p 0 -X stuff "command^M"
Manual steps at later time:
- I log in remotely as user "ubuntu" in another terminal (TTY).
I re-attach to the GNU screen session started in step 2:
screen -r
- I am able to view past and current output of the process started in step 3.
Questions:
- Is this the most effective way to achieve the desired outcome?
- How can the commands in step 2 & 3 be automated?
- How can the commands in step 2 & 3 not activate when I log in manually in step 4?