Hi guys,
We've been trying to make a cronjob to create a new session of tmux after reboot, so later after an ssh connection or directly with a screen located in /dev/tty1 we can attach the shown terminal to the already made session.
After making a simple .sh to do so in "sudo crontab -e":
@reboot /bin/bash /home/USER/start.sh
With start.sh as
#!/bin/bash
/bin/sleep 5
source /home/debian/.bashrc
/usr/bin/tmux new-session -d -s session1
/usr/bin/tmux send-keys -t session1 "source /home/USER/.bashrc" C-m
/usr/bin/tmux send-keys -t session1 "echo \"hello\"" C-m
After connecting via ssh and doing "tmux attach-session -t session1" in that terminal we get the message "no sessions"
The opened terminal tty is "/dev/pts/1" when I run this script so I assume the usual "/dev/pts/0" is being occupied during the cronjob, but we find ourselves unable to access it. Any idea of what we are doing wrong?
Any help would be appreciated, Thanks!