我试过将它添加到我的 crontab 中:
@reboot/root/启动
“启动”文件:
#!/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
现在 svnserve 命令运行良好。问题出在 screen 命令上。
log1 和 log2 文件具有相同的内容,即:必须连接到终端。
我想做的是在启动时启动这 2 个可执行文件,然后再通过某种方式访问它们。
有办法吗?
最佳答案
您想将以下选项添加到“screen ”命令(例如,在 -S
之前):-d -m
从联机帮助页:
-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.
关于linux - 使用 crontab 在 @reboot 上运行 "screen -S name ./script"命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17436625/