开发者

Launching a Perl script without output

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?


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 &


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜