全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码

[疑问] 请教一个screen命令的问题

[复制链接]
 楼主| 发表于 2021-5-7 22:16:45 | 显示全部楼层
h20 发表于 2021-5-7 22:13
上面说了呀
screen -dmS [name] [command]

我以为你还有什么其他方法呢
发表于 2021-5-7 22:26:22 | 显示全部楼层
命令行分离。。?
在screen里面 ctrl+A 然后输入:detach
或者再开个terminal, 在screen外面 screen -S [name] -X detach
发表于 2021-5-7 22:27:37 | 显示全部楼层
其实完全可以全程不进入screen
screen -dmS [name]
screen -S [name] -X exec '/bin/bash cmd1'
screen -S [name] -X exec '/bin/bash cmd2'
...
发表于 2021-5-7 22:41:16 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2021-5-7 22:55:52 | 显示全部楼层
nohup setsid 都可以后台运行
发表于 2021-5-7 23:44:19 | 显示全部楼层
楼主用我的这条吧,保证能行,screen -d -m -S [name]  [command],直接回车 这条命令相当于执行了命令后,再分离窗口,执行后查看进程,screen已经在后台了。
 楼主| 发表于 2021-5-8 01:26:27 | 显示全部楼层
zxxx 发表于 2021-5-7 21:22
screen -dmS openwrt bash -c 'command'

screen -list

command里面用wget好像不生效啊
 楼主| 发表于 2021-5-8 01:29:33 | 显示全部楼层
h20 发表于 2021-5-7 22:41
那你想要啥效果又不说,nohup也行啊

你这个screen -dmS [name] [command] 命令

我要同时跑wget &&  tar && make 咋整呢
 楼主| 发表于 2021-5-8 01:34:16 | 显示全部楼层
dunce 发表于 2021-5-7 22:27
其实完全可以全程不进入screen
screen -dmS [name]
screen -S [name] -X exec '/bin/bash cmd1'

我要全程不进去screen,并且一次运行多个命令 比如wget,tar,make,该怎么写
发表于 2021-5-8 01:38:41 | 显示全部楼层
叫我ams就好了 发表于 2021-5-8 01:26
command里面用wget好像不生效啊

screen -dmS openwrt bash -c 'wget http://hel.icmp.hetzner.com/100MB.bin'
screen -r openwrt
--2021-05-07 17:37:12--  http://hel.icmp.hetzner.com/100MB.bin
Resolving hel.icmp.hetzner.com (hel.icmp.hetzner.com)... 95.217.255.81, 2a01:4f9:0:a010::20
Connecting to hel.icmp.hetzner.com (hel.icmp.hetzner.com)|95.217.255.81|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: ‘100MB.bin’

100MB.bin         100%[===================>] 100.00M  11.9MB/s    in 8.5s

2021-05-07 17:37:21 (11.7 MB/s) - ‘100MB.bin’ saved [104857600/104857600]

100MB.bin  bin  scripts  workspace
root@server:~#
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-5-11 07:46 , Processed in 0.067985 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表