Search code examples
linuxubuntuserver

Screen session is not creating and running on Ubuntu


I connected via ssh to my Ubuntu server. And I want to create a screen session with a command to run sh script.

I'm trying to do it this way:

screen -dm -S myserver server/start.sh 

But nothing happens. Even screen list is empty.

screen -list
No Sockets found in /run/screen/S-root.

How can I fix it?

Ubuntu 20.04, Screen version 4.08.00 (GNU) 05-Feb-20

Also, I want to put this command on system unit, to make systemd to run the script at system boot. But I can't to make it runs even using a command via ssh.


Solution

  • The problem was that script was failing with an error. I should make cd to run the script.

    screen -S myserver -dm bash -c "cd server;sh start.sh"