/dev/pts/0 being in use will make no difference.
You put this in root's crontab, so tmux will be running as root, is that
what you intend?
If so and you still cannot attach as root, then likely your script is
failing for some other reason so you will need to debug it.
Does the script work if you run it manually?
What if you run it from cron like this:
/bin/bash -x /path/to/script 2>/tmp/log
Does /tmp/log show errors? You may want to add "|| exit 1" to all the
commands to work out which one it stops at.
On Thu, 13 Jan 2022 at 15:20, Gabriel Lupini <[email protected]> wrote:
> 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!
>
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/tmux-users/60a26273-02f3-4f9d-a460-a9f3c63b6634n%40googlegroups.com
> <https://groups.google.com/d/msgid/tmux-users/60a26273-02f3-4f9d-a460-a9f3c63b6634n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/CAEdLfcE-W60qb-3_t%3DSG%3DW-A692d96OwE_Az4M6XE-YAnGgNRA%40mail.gmail.com.