Run the command "screen -S name./script" on @reboot with crontab

I tried adding this to my crontab:

@ reboot / root / startup

File "startup":

#!/bin/sh svnserve -d -r /root/svnrepos/mainres svnserve -d -r /root/svnrepos/mapres --listen-port=3691 screen -S mta ./mtaserver/mta-server > log1 screen -S mapmta ./mapserver/mta-server > log2 exit 0 

Now svnserve commands work fine. The problem is the screen command.

log1 and log2 have the same content that: must be connected to the terminal.

What I'm trying to do is run 2 executable files at startup, and then access them.

Is there any way to do this?

+4
source share
1 answer

You want to add the following parameters to the "screen" commands (for example, before -S ): -d -m With manpage:

  -d -m Start screen in "detached" mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts. 
+9
source

Source: https://habr.com/ru/post/1489368/


All Articles