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?
Asked
Active
Viewed 446 times
0

Adrian Frühwirth
- 42,970
- 10
- 60
- 71

Jon
- 2,932
- 2
- 23
- 30
2 Answers
5
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 &

Andrew White
- 52,720
- 19
- 113
- 137
-
Wont this keep the first script hanging until the other dies/exits though? – Jon Jan 11 '11 at 02:39
2
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

J-16 SDiZ
- 26,473
- 4
- 65
- 84