main.pm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. package Rstat::main;
  2. #
  3. # Copyright (C) Roman Dmitiriev, rnd@rajven.ru
  4. #
  5. use utf8;
  6. use strict;
  7. use English;
  8. use FindBin '$Bin';
  9. use lib "$Bin";
  10. use base 'Exporter';
  11. use vars qw(@EXPORT @ISA);
  12. use Rstat::config;
  13. use Socket;
  14. use IO::Select;
  15. use IO::Handle;
  16. our @ISA = qw(Exporter);
  17. our @EXPORT = qw(
  18. log_file
  19. write_to_file
  20. wrlog
  21. log_session
  22. log_warning
  23. log_info
  24. log_debug
  25. log_error
  26. log_die
  27. timestamp
  28. do_exec
  29. do_exec_ref
  30. do_exit
  31. sendEmail
  32. IsNotRun
  33. IsMyPID
  34. Add_PID
  35. Remove_PID
  36. IsNotLocked
  37. IsMyLock
  38. Add_Lock
  39. Remove_Lock
  40. DefHash
  41. read_file
  42. AddToConfig
  43. RemoveFromConfig
  44. uniq
  45. strim
  46. trim
  47. is_integer
  48. is_float
  49. run_in_parallel
  50. translit
  51. );
  52. BEGIN
  53. {
  54. #---------------------------------------------------------------------------------------------------------
  55. sub log_file {
  56. return if (!$_[0]);
  57. return if (!$_[1]);
  58. return if (!$_[2]);
  59. open (LG,">>$_[0]") || die("Error open log file $_[0]!!! die...");
  60. my ($sec,$min,$hour,$mday,$mon,$year) = (localtime())[0,1,2,3,4,5];
  61. $mon += 1; $year += 1900;
  62. my @msg = split("\n",$_[2]);
  63. foreach my $row (@msg) {
  64. next if (!$row);
  65. printf LG "%04d%02d%02d-%02d%02d%02d %s [%d] %s\n",$year,$mon,$mday,$hour,$min,$sec,$_[1],$$,$row;
  66. }
  67. close (LG);
  68. if ($< ==0) {
  69. my $uid = getpwnam $log_owner_user;
  70. my $gid = getgrnam $log_owner_user;
  71. if (!$gid) { $gid=getgrnam "root"; }
  72. if (!$uid) { $uid=getpwnam "root"; }
  73. chown $uid, $gid, $_[0];
  74. chmod oct("0660"), $_[0];
  75. }
  76. }
  77. #---------------------------------------------------------------------------------------------------------
  78. sub write_to_file {
  79. return if (!$_[0]);
  80. return if (!$_[1]);
  81. my $f_name = shift;
  82. my $cmd = shift;
  83. my $append = shift;
  84. if ($append) {
  85. open (LG,">>$f_name") || die("Error open file $f_name!!! die...");
  86. } else {
  87. open (LG,">$f_name") || die("Error open file $f_name!!! die...");
  88. }
  89. if (ref($cmd) eq 'ARRAY') {
  90. foreach my $row (@$cmd) {
  91. next if (!$row);
  92. print LG $row."\n";
  93. }
  94. } else {
  95. my @msg = split("\n",$cmd);
  96. foreach my $row (@msg) {
  97. next if (!$row);
  98. print LG $row."\n";
  99. }
  100. }
  101. close (LG);
  102. }
  103. #---------------------------------------------------------------------------------------------------------
  104. sub wrlog {
  105. my $level = shift;
  106. my $string = shift;
  107. my $PRN_LEVEL = 'INFO:';
  108. if ($level == $W_INFO) { log_info($string); }
  109. if ($level == $W_ERROR) { $PRN_LEVEL = 'ERROR:'; log_error($string); }
  110. if ($level == $W_DEBUG) { $PRN_LEVEL = 'DEBUG'; log_debug($string); }
  111. my @msg = split("\n",$string);
  112. foreach my $row (@msg) {
  113. next if (!$row);
  114. print $PRN_LEVEL.' '.$row."\n";
  115. }
  116. }
  117. #---------------------------------------------------------------------------------------------------------
  118. sub log_session { log_file($LOG_COMMON,"SESSION:",$_[0]) if ($log_enable); }
  119. #---------------------------------------------------------------------------------------------------------
  120. sub log_info { log_file($LOG_COMMON,"INFO:",$_[0]) if ($log_enable); }
  121. #---------------------------------------------------------------------------------------------------------
  122. sub log_warning { log_file($LOG_COMMON,"WARN:",$_[0]) if ($log_enable); }
  123. #---------------------------------------------------------------------------------------------------------
  124. sub log_debug { log_file($LOG_DEBUG,"DEBUG:",$_[0]) if $debug; }
  125. #---------------------------------------------------------------------------------------------------------
  126. sub log_error { log_file($LOG_ERR,"ERROR:",$_[0]) if ($log_enable); }
  127. #---------------------------------------------------------------------------------------------------------
  128. sub log_die {
  129. wrlog($W_ERROR,$_[0]);
  130. my $worktime = time()-$BASETIME;
  131. log_info("Script work $worktime sec.");
  132. sendEmail("$HOSTNAME - $MY_NAME die! ","Process: $MY_NAME aborted with error:\n$_[0]");
  133. die ($_[0]);
  134. }
  135. #---------------------------------------------------------------------------------------------------------
  136. sub timestamp {
  137. my $worktime = time()-$BASETIME;
  138. log_info("TimeStamp: $worktime sec.");
  139. }
  140. #---------------------------------------------------------------------------------------------------------.
  141. sub do_exec_ref {
  142. my $ret = `$_[0]`;
  143. my $res = $?;
  144. my %result;
  145. chomp($ret);
  146. $result{output}=$ret;
  147. $result{status}=$res;
  148. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  149. if ($res eq "0") { log_info("Run: $_[0] - $ret"); } else { log_error("Run: $_[0] - $ret"); }
  150. return %result;
  151. }
  152. #---------------------------------------------------------------------------------------------------------
  153. sub do_exec {
  154. my $ret = `$_[0]`;
  155. my $res = $?;
  156. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  157. if ($res eq "0") {
  158. log_info("Run: $_[0] - $ret");
  159. } else {
  160. $ret = "Error";
  161. log_error("Run: $_[0] - $ret");
  162. }
  163. return $ret;
  164. }
  165. #---------------------------------------------------------------------------------------------------------
  166. sub do_exit {
  167. my $worktime = time()-$BASETIME;
  168. my $code;
  169. if ($_[0]) { $code = $_[0]; } else { $code = 0; }
  170. log_info("Script work $worktime sec. Exit code: $code");
  171. exit $code;
  172. }
  173. #---------------------------------------------------------------------------------------------------------
  174. sub sendEmail {
  175. my ($subject, $message, $crf) = @_;
  176. return if (!$send_email);
  177. my $sendmail = '/sbin/sendmail';
  178. open(MAIL, "|$sendmail -oi -t");
  179. print MAIL "From: $sender_email\n";
  180. print MAIL "To: $admin_email\n";
  181. print MAIL "Subject: $subject\nMIME-Version: 1.0\nContent-Language: ru\nContent-Type: text/html; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n";
  182. print MAIL '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
  183. print MAIL '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
  184. print MAIL "<head><title>$subject </title></head><body>\n";
  185. my @msg = split("\n",$message);
  186. foreach my $row (@msg) {
  187. if ($crf) { print MAIL "$row<br>"; } else { print MAIL "$row\n"; };
  188. }
  189. print MAIL "</body></html>\n";
  190. close(MAIL);
  191. log_info("Send email from $sender_email to $admin_email with subject: $subject");
  192. log_debug("Body:\n$message");
  193. }
  194. #---------------------------------------------------------------------------------------------------------
  195. ### Check few run script
  196. sub IsNotRun {
  197. my $pname = shift;
  198. my $lockfile = $pname.".pid";
  199. # if pid file not exists - OK
  200. log_debug("Check what pid file $lockfile exists.");
  201. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  202. open (FF,"<$lockfile") or log_die("can't open file $lockfile: $!");
  203. my $lockid = <FF>;
  204. close(FF);
  205. chomp($lockid);
  206. # If the process ID belongs to the current program - OK
  207. if ($lockid eq $$) { log_debug("pid file found, but owner is this process. Continue. "); return 1; }
  208. # if owner of this process ID not exists - OK
  209. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  210. chomp($process_count);
  211. log_debug("Process count with id $lockid is $process_count");
  212. if ($process_count==0) { log_debug("pid file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  213. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  214. return 0;
  215. }
  216. #---------------------------------------------------------------------------------------------------------
  217. sub IsMyPID {
  218. my $pname = shift;
  219. my $lockfile = $pname.".pid";
  220. log_debug("Check what pid file $lockfile exists.");
  221. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  222. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  223. my $lockid = <FF>;
  224. close(FF);
  225. chomp($lockid);
  226. if ($lockid eq $$) { log_debug("pid file is my. continue."); return 1; }
  227. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  228. return 0;
  229. }
  230. #---------------------------------------------------------------------------------------------------------
  231. sub Add_PID {
  232. my $pname = shift;
  233. my $lockfile = $pname.".pid";
  234. log_debug("Try create lock file $lockfile");
  235. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  236. flock(FF,2) or log_die "can't flock $lockfile: $!";
  237. print FF $$;
  238. close(FF);
  239. log_debug("Ok.");
  240. return 1;
  241. }
  242. #---------------------------------------------------------------------------------------------------------
  243. sub Remove_PID {
  244. my $pname = shift;
  245. my $lockfile = $pname.".pid";
  246. log_debug("Check what pid file $lockfile exists.");
  247. if (! -e $lockfile) { log_debug("pid file not exists. Continue."); return 1; }
  248. unlink $lockfile or return 0;
  249. log_debug("pid file $lockfile removed.");
  250. return 1;
  251. }
  252. #---------------------------------------------------------------------------------------------------------
  253. sub IsNotLocked {
  254. my $lockfile = $_[0] . ".lock";
  255. log_debug("Check what lock file $lockfile exists.");
  256. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 1; }
  257. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  258. my $lockid = <FF>;
  259. close(FF);
  260. chomp($lockid);
  261. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  262. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  263. if ($process_count lt 1) { log_debug("lock file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  264. log_debug("Another proceess with pid: $lockid already use $_[0]");
  265. return 0;
  266. }
  267. #---------------------------------------------------------------------------------------------------------
  268. sub IsMyLock {
  269. my $lockfile = $_[0] . ".lock";
  270. log_debug("Check what lock file $lockfile exists.");
  271. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 0; }
  272. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  273. my $lockid = <FF>;
  274. close(FF);
  275. chomp($lockid);
  276. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  277. log_debug("file $_[0] used by process with pid: $lockid");
  278. return 0;
  279. }
  280. #---------------------------------------------------------------------------------------------------------
  281. sub Add_Lock {
  282. if (!IsNotLocked($_[0])) { return 0; }
  283. my $lockfile = $_[0] . ".lock";
  284. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  285. flock(FF,2) or log_die "can't flock $lockfile: $!";
  286. print FF $$;
  287. close(FF);
  288. log_debug("Create lock file for $_[0]");
  289. return 1;
  290. }
  291. #---------------------------------------------------------------------------------------------------------
  292. sub Remove_Lock {
  293. if (!IsNotLocked($_[0])) { return 0; }
  294. my $lockfile = $_[0] . ".lock";
  295. if (! -e $lockfile) { return 1; }
  296. unlink $lockfile or return 0;
  297. log_debug("Lock file for $_[0] removed");
  298. return 1;
  299. }
  300. #---------------------------------------------------------------------------------------------------------
  301. sub DefHash {
  302. my $hash=$_[0];
  303. my $num_list = $_[1];
  304. my %num_keys;
  305. if ($num_list) {
  306. my @ret_num = split(' ',$num_list);
  307. %num_keys = map { $_, 1 } @ret_num;
  308. }
  309. foreach my $key (keys %$hash) {
  310. my $null_value = "";
  311. $null_value = 0 if (defined $num_keys{$key});
  312. $hash->{$key}=$null_value if (!defined($hash->{$key}));
  313. }
  314. return $hash;
  315. }
  316. #---------------------------------------------------------------------------------------------------------
  317. sub read_file {
  318. my $filename = shift;
  319. return if (!$filename);
  320. return if (!-e $filename);
  321. open (FF,"<$filename") or die "unable to open file $filename!" ;
  322. my @tmp=<FF>;
  323. close(FF);
  324. chomp(@tmp);
  325. return @tmp;
  326. }
  327. #---------------------------------------------------------------------------------------------------------
  328. sub AddToConfig {
  329. my $conf_str = $_[0];
  330. my $conf_file = $_[1];
  331. my $res;
  332. eval {
  333. $SIG{ALRM} = sub { die "time-alarm\n" };
  334. alarm $WAIT_TIME;
  335. while (!Add_Lock($conf_file)) {
  336. my $wait = int(rand($MAX_SLEEP));
  337. if ($wait lt $MIN_SLEEP) { $wait = $MIN_SLEEP; }
  338. sleep $wait;
  339. }
  340. my @conf_array=();
  341. @conf_array=read_conf($conf_file);
  342. my %list = map { $_, 1 } @conf_array;
  343. if (exists $list{$conf_str}) { Remove_Lock($conf_file); return 1; }
  344. open(FR,">$conf_file") or log_die "Unable to open config file $conf_file!" ;
  345. flock(FR,2);
  346. push(@conf_array,$conf_str);
  347. print FR "$WARN_MSG";
  348. foreach my $row (@conf_array) { print FR "$row\n"; };
  349. close(FR);
  350. Remove_Lock($conf_file);
  351. $SIG{ALRM} = 'DEFAULT';
  352. };
  353. if ( $@ eq "time-alarm\n" ) {
  354. log_die "Script aborted after timeout $WAIT_TIME sec. Unable to add $conf_str to config file $conf_file...\n";
  355. }
  356. return 1;
  357. }
  358. #---------------------------------------------------------------------------------------------------------
  359. sub RemoveFromConfig {
  360. my $conf_str = $_[0];
  361. my $conf_file = $_[1];
  362. my $res;
  363. eval {
  364. $SIG{ALRM} = sub { die "time-alarm\n" };
  365. alarm $WAIT_TIME;
  366. while (!Add_Lock($conf_file)) {
  367. my $wait = int(rand($MAX_SLEEP));
  368. if ($wait lt $MIN_SLEEP) { $wait = $MIN_SLEEP; }
  369. sleep $wait;
  370. }
  371. my @conf_array=();
  372. @conf_array=read_conf($conf_file);
  373. my %list = map { $_, 1 } @conf_array;
  374. if (!exists $list{$conf_str}) { Remove_Lock($conf_file); return 1; }
  375. my @tmp = grep {/!^$conf_str$/} @conf_array;
  376. open(FF,">$conf_file");
  377. flock(FF,2);
  378. print FF "$WARN_MSG";
  379. foreach my $row (@tmp) { print FF $conf_str ."\n"; };
  380. close(FF);
  381. Remove_Lock($conf_file);
  382. $SIG{ALRM} = 'DEFAULT';
  383. };
  384. if ( $@ eq "time-alarm\n" ) { log_die "Script aborted after timeout $WAIT_TIME sec. Unable to del $conf_str from config file $conf_file...\n"; }
  385. return 1;
  386. }
  387. #---------------------------------------------------------------------------------------------------------
  388. sub uniq (\@) {
  389. my @tmp = @{(shift)};
  390. if (scalar(@tmp) eq 0) { return @tmp; }
  391. chomp(@tmp);
  392. my %newlist = map { $_, 1 } @tmp;
  393. return keys %newlist;
  394. }
  395. #---------------------------------------------------------------------------------------------------------
  396. sub strim {
  397. my $str=shift;
  398. return if (!$str);
  399. #$str =~ s/.*[^[:print:]]+//g;
  400. #$str =~ s/[^[:print:]]+//g;
  401. #$str =~ s/[^(a-z|A-Z|0-9|\:|\-|\s|\.)]//g;
  402. #$str =~ s/[:^print:]//g;
  403. $str =~ s/[^[:ascii:]]//g;
  404. $str =~ s/^\s+//g;
  405. $str =~ s/\s+$//g;
  406. return $str;
  407. }
  408. #---------------------------------------------------------------------------------------------------------
  409. sub trim {
  410. my $str=shift;
  411. return if (!$str);
  412. $str =~ s/\n/ /g;
  413. $str =~ s/^\s+//g;
  414. $str =~ s/\s+$//g;
  415. return $str;
  416. }
  417. #---------------------------------------------------------------------------------------------------------
  418. sub is_integer {
  419. defined $_[0] && $_[0] =~ /^[+-]?\d+$/;
  420. }
  421. #---------------------------------------------------------------------------------------------------------
  422. sub is_float {
  423. defined $_[0] && $_[0] =~ /^[+-]?\d+(\.\d+)?$/;
  424. }
  425. #---------------------------------------------------------------------------------------------------------
  426. sub run_in_parallel(\@) {
  427. my @commands = @{(shift)};
  428. my @result = ();
  429. return @result if (!@commands or !scalar(@commands));
  430. my $count = scalar(@commands);
  431. my $start = 0;
  432. while ($start<=$count-1) {
  433. my @run_list=();
  434. my $select = IO::Select->new();
  435. my $stop = $start + $parallel_process_count;
  436. $stop=$count-1 if ($stop >=$count);
  437. for (my $index = $start; $index <=$stop; $index++) {
  438. next if (!$commands[$index]);
  439. my $cmd=$commands[$index];
  440. log_info("Starting ".$cmd);
  441. my ($hchild, $hparent, $childid);
  442. socketpair($hchild, $hparent, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!";
  443. $childid = fork;
  444. die "cannot fork" if($childid == -1);
  445. # redirect child Input|Output
  446. unless($childid) {
  447. open STDIN, "<&", $hparent;
  448. open STDOUT, ">&", $hparent;
  449. open STDERR, ">&", $hparent;
  450. close $hparent;
  451. close $hchild;
  452. $select->remove($_) and close $_ for($select->handles);
  453. exec "/bin/nice -n 15 ".$cmd;
  454. }
  455. close $hparent;
  456. $select->add($hchild);
  457. }
  458. while (my @ready = $select->can_read) {
  459. next if (!@ready or !scalar(@ready));
  460. for my $read(@ready) {
  461. if($read->eof || $read->error) {
  462. # child exit
  463. $select->remove($read);
  464. close $read;
  465. next;
  466. }
  467. if(defined(my $str = <$read>)) {
  468. log_info("Read:".$str);
  469. push(@result,$str);
  470. }
  471. }
  472. }
  473. $start = $stop+1;
  474. }
  475. return (@result);
  476. }
  477. sub translit {
  478. my $textline=shift;
  479. return if (!$textline);
  480. $textline =~ s/А/A/g; $textline =~ s/а/a/g;
  481. $textline =~ s/Б/B/g; $textline =~ s/б/b/g;
  482. $textline =~ s/В/V/g; $textline =~ s/в/v/g;
  483. $textline =~ s/Г/G/g; $textline =~ s/г/g/g;
  484. $textline =~ s/Д/D/g; $textline =~ s/д/d/g;
  485. $textline =~ s/Е/E/g; $textline =~ s/е/e/g;
  486. $textline =~ s/Ё/E/g; $textline =~ s/ё/e/g;
  487. $textline =~ s/Ж/Zh/g; $textline =~ s/ж/zh/g;
  488. $textline =~ s/З/Z/g; $textline =~ s/з/z/g;
  489. $textline =~ s/И/I/g; $textline =~ s/и/i/g;
  490. $textline =~ s/Й/I/g; $textline =~ s/й/i/g;
  491. $textline =~ s/К/K/g; $textline =~ s/к/k/g;
  492. $textline =~ s/Л/L/g; $textline =~ s/л/l/g;
  493. $textline =~ s/М/M/g; $textline =~ s/м/m/g;
  494. $textline =~ s/Н/N/g; $textline =~ s/н/n/g;
  495. $textline =~ s/О/O/g; $textline =~ s/о/o/g;
  496. $textline =~ s/П/P/g; $textline =~ s/п/p/g;
  497. $textline =~ s/Р/R/g; $textline =~ s/р/r/g;
  498. $textline =~ s/ТС/T-S/g; $textline =~ s/Тс/T-s/g; $textline =~ s/тс/t-s/g;
  499. $textline =~ s/С/S/g; $textline =~ s/с/s/g;
  500. $textline =~ s/Т/T/g; $textline =~ s/т/t/g;
  501. $textline =~ s/У/U/g; $textline =~ s/у/u/g;
  502. $textline =~ s/Ф/F/g; $textline =~ s/ф/f/g;
  503. $textline =~ s/Х/Kh/g; $textline =~ s/х/kh/g;
  504. $textline =~ s/Ц/Ts/g; $textline =~ s/ц/ts/g;
  505. $textline =~ s/Ч/Ch/g; $textline =~ s/ч/ch/g;
  506. $textline =~ s/Ш/Sh/g; $textline =~ s/ш/sh/g;
  507. $textline =~ s/Щ/Shch/g; $textline =~ s/щ/shch/g;
  508. $textline =~ s/Ь/'/g; $textline =~ s/ь/'/g;
  509. $textline =~ s/Ы/Y/g; $textline =~ s/ы/y/g;
  510. $textline =~ s/Ъ/''/g; $textline =~ s/ъ/''/g;
  511. $textline =~ s/Э/E/g; $textline =~ s/э/e/g;
  512. $textline =~ s/Ю/Yu/g; $textline =~ s/ю/yu/g;
  513. $textline =~ s/Я/Ya/g; $textline =~ s/я/ya/g;
  514. return $textline;
  515. }
  516. #log_file($LOG_COMMON,"INFO:","----------------------------------------------------------------------------------------");
  517. #log_file($LOG_COMMON,"INFO:","Run script $0. Pid: $$ Pid file: $SPID.pid");
  518. #log_file($LOG_COMMON,"INFO:","User uid: $< Effective uid: $>");
  519. #log_file($LOG_COMMON,"INFO:","Status:");
  520. #log_file($LOG_COMMON,"INFO:","Logging enabled: $log_enable");
  521. #log_file($LOG_COMMON,"INFO:","Logging debug: $debug");
  522. 1;
  523. }