/[pxelator]/lib/PXElator/screen.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/PXElator/screen.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 95 - (show annotations)
Fri Jul 31 20:08:06 2009 UTC (11 years, 5 months ago) by dpavlin
File size: 928 byte(s)
be less chatty without debug

1 package screen;
2
3 use warnings;
4 use strict;
5 use autodie;
6
7 use File::Slurp;
8
9 use log;
10 use server;
11
12 our $debug = server::debug;
13
14 my $screenrc = '/tmp/screenrc';
15
16 sub screen_daemon {
17 my $daemon = shift;
18 my $run = "sudo perl -I$server::base_dir/lib/PXElator -I$server::base_dir/lib -M$daemon -e " . $daemon . "::start";
19 warn "screen_daemon $daemon $run\n";
20 qq|
21
22 split
23
24 screen -t $daemon $run
25 logfile $log::dir/pxelator.$daemon.log
26 log on
27
28 focus down
29 |}
30
31 write_file $screenrc, qq|
32
33 autodetach off
34 altscreen off
35 defscrollback 10000
36 startup_message off
37
38 sessionname PXElator
39
40 |
41 . screen_daemon('dhcpd')
42 . screen_daemon('tftpd')
43 #. screen_daemon('httpd')
44 . qq|remove|;
45 ;
46
47 warn "screenrc $screenrc ", -s $screenrc if $debug;
48
49 sub start {
50
51 my $screen="screen -R PXElator -c $screenrc";
52 warn $screen;
53
54 chdir $server::base_dir;
55
56 if ( defined $ENV{DISPLAY} ) {
57 exec "xterm -fg yellow -e $screen";
58 } else {
59 exec $screen;
60 }
61
62 }
63
64 1;

  ViewVC Help
Powered by ViewVC 1.1.26