Эх сурвалжийг харах

Added Fallback ScreenRC File

own3mall 6 жил өмнө
parent
commit
00f2192a64
2 өөрчлөгдсөн 17 нэмэгдсэн , 0 устгасан
  1. 9 0
      ogp_agent.pl
  2. 8 0
      ogp_screenrc_bk

+ 9 - 0
ogp_agent.pl

@@ -76,6 +76,8 @@ use constant GAME_STARTUP_DIR =>
   Path::Class::Dir->new(AGENT_RUN_DIR, 'startups');
 use constant SCREENRC_FILE =>
   Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc');
+use constant SCREENRC_FILE_BK =>
+  Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc_bk');
 use constant SCREENRC_TMP_FILE =>
   Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc.tmp');
 use constant SCREEN_TYPE_HOME   => "HOME";
@@ -153,6 +155,13 @@ if (-e AGENT_LOG_FILE)
 	logger "New log file created";
 }
 
+# If for some reason the screenrc file doesn't exist, restore it from the backup copy
+# I've seen this happen a few times
+if (! -e SCREENRC_FILE)
+{
+	copy(SCREENRC_FILE_BK,SCREENRC_FILE);
+}
+
 open INPUTFILE, "<", SCREENRC_FILE or die $!;
 open OUTPUTFILE, ">", SCREENRC_TMP_FILE or die $!;
 my $dest = SCREEN_LOGS_DIR . "/screenlog.%t";

+ 8 - 0
ogp_screenrc_bk

@@ -0,0 +1,8 @@
+startup_message off
+hardstatus on
+hardstatus alwayslastline '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}[%{W}%n%f %t%?(%u)%?%{=b kR}]%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %D %m/%d %C%a ]%{W}'
+# Default scroll back 100
+defscrollback 100
+deflog on
+logfile $PWD/screenlogs/screenlog.%t
+