启动没有输出的 Perl 脚本

发布于 10-11 23:36 字数 218 浏览 7 评论 0原文

我正在制作一个脚本(Perlshell)来启动第二个 Perl 脚本。它启动的脚本有数千行输出。所以基本上我想制作一个脚本来启动另一个脚本而没有任何输出 - 如果可能的话在 screen 会话中运行它,然后退出该脚本(但保持另一个在 screen< /代码>)?我该怎么做?

I'm making a script (Perl or shell) that launches a second Perl script. The script that it's launching has thousands of lines of output. So basically I want to make a script that launches another script without any output - and if possible run it within a screen session and then exit the script (yet keep the other running in the screen)? How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天赋异禀2024-10-18 23:36:24

当您启动脚本时,直接输出到/dev/null。 要使脚本在后台运行,请使用 & 符号。例如,以下内容将在控制台中不显示任何内容并在后台运行......

echo hi > /dev/null &

When you launch your script direct output to /dev/null. To make a script run in the background use the & symbol. For example the follow will show nothing in the console and run in the background...

echo hi > /dev/null &
時窥2024-10-18 23:36:24

如果你想在screen中运行,你必须创建一个screenrc

#!/bin/sh
echo "screen  my_perl_program" >  /tmp/$.screenrc
echo "autodetach on" >>  /tmp/$.screenrc
echo "startup_message off" >>  /tmp/$.screenrc
screen -L -dm -S session1 -c  /tmp/$.screenrc

然后你可以用screen -S session1恢复它

If you want to run in screen, you have to create a screenrc

#!/bin/sh
echo "screen  my_perl_program" >  /tmp/$.screenrc
echo "autodetach on" >>  /tmp/$.screenrc
echo "startup_message off" >>  /tmp/$.screenrc
screen -L -dm -S session1 -c  /tmp/$.screenrc

Then you can restore it with screen -S session1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文