I have my "c" application which uses a lot of printf to display the necessary information. Application has started automatically at boot time (using init.d or systemd). How I can access to it's console? I am not interesting in all data since application was started. I want to view current data... Should I use tmux?
1 Answer
Thanks topic. I solved for Ubuntu 24. This is my step-by-step explanation.
Preparation
sudo apt install htop nano tmux -y
Make service to call tmux and start the application (in this example htop but it can be any user application).
sudo nano /etc/systemd/system/myservice.service
[Unit] Description=my tmux service After=multi-user.target # https://unix.stackexchange.com/questions/404667/systemd-service-what-is-multi-user-target [Service] User=q Group=q ExecStart=bash -c "tmux new-session -s q -d 'htop'" Type=forking [Install] WantedBy=multi-user.target
Ask systemd to start our service at boot.
sudo systemctl enable myservice.service
Service will start after reboot. We should do reboot or start immediately.
sudo systemctl start myservice
You can connect long way
ssh [email protected] tmux attach
Or you can connect short way. Thanks topic
ssh [email protected] -t tmux a