I run a screen with a few screens, every boot time, and it works, but when I login and if I create new screen it will load without shell, so I basically have to do exec bash to get nice working terminal. Is it possible to activate screen via cron/@boot so that it will be started as if I start it from terminal my self.
I start screen in rc.local like following:
screen -dmS d bash -c 'ytop; exec bash'
screen -S d -X screen 1 bash -c 'podman run -it --name f35_ovpn; exec bash'
I do not know how you use rc.local ? Just know that the old (before systemd) way it is depreciated.
See on the bottom the “update” section too.
I do not know which DE you are using? … in my case on Gnome & Mate I can activate under the “Terminal preferences” , Command > Run command as a login shell.
Are you in the dialout group with the user you call it?
About the dialout group I mentioned because last time I used Screen I was connecting to an UART chip via serial. So the group was still needed to be able to do so. Seams to be old stuff from the modem times.
It’s a server environment, so I don’t use DE. Systemd has an option to activate rc.local service systemctl enable rc-local.service so that you can run any manual scripts on startup.
But same happens if I run/start screen from crontab. Looks like that it doesn’t start as if from interactive session, so I wonder how to activate screen as if manually, at terminal I would type screen -S myscr
But is it working for you?
For me it didn’t even start the screen. I didn’t restart computer, I’ve just did systemct --user start screen.serviceand I did enable it and loginctl enable-linger $USER (although I don’t know what it does.
man loginctl |grep -B2 -A2 linger
enable-linger [USER...], disable-linger [USER...]
Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned
for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running
services. Takes one or more user names or numeric UIDs as argument. If no argument is specified,
enables/disables lingering for the user of the session of the caller.
â—‹ screen.service - Playing around with screen
Loaded: loaded (/etc/xdg/systemd/user/screen.service; enabled; preset: disabled)
Active: inactive (dead) since Thu 2023-01-12 17:25:58 CET; 6s ago
Duration: 5ms
Process: 774353 ExecStart=/etc/cron.b/tst-scr (code=exited, status=0/SUCCESS)
Main PID: 774353 (code=exited, status=0/SUCCESS)
CPU: 6ms
Jan 12 17:25:58 bs5 systemd[3978]: Started screen.service - Playing around with screen.
So it looks like it’s not possible to start screen with user environment via crontab/rc.local/service. It only works when started via interactive terminal. I’ve been trying to find this solution for a while, but no luck, so normally, I have to redo all screens after reboot, but at least it starts some utils, that I need on boot time, namely interactive podman sessions, and some other utils