main.pm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. package Rstat::main;
  2. #
  3. # Copyright (C) Roman Dmitiriev, rnd@rajven.ru
  4. #
  5. use strict;
  6. use English;
  7. use FindBin '$Bin';
  8. use lib "$Bin";
  9. use base 'Exporter';
  10. use vars qw(@EXPORT @ISA);
  11. use Rstat::config;
  12. use Socket;
  13. use IO::Select;
  14. use IO::Handle;
  15. our @ISA = qw(Exporter);
  16. our @EXPORT = qw(
  17. log_file
  18. write_to_file
  19. wrlog
  20. log_session
  21. log_warning
  22. log_info
  23. log_debug
  24. log_error
  25. log_die
  26. timestamp
  27. do_exec
  28. do_exec_ref
  29. do_exit
  30. sendEmail
  31. IsNotRun
  32. IsMyPID
  33. Add_PID
  34. Remove_PID
  35. IsNotLocked
  36. IsMyLock
  37. Add_Lock
  38. Remove_Lock
  39. DefHash
  40. read_file
  41. AddToConfig
  42. RemoveFromConfig
  43. uniq
  44. strim
  45. trim
  46. is_integer
  47. is_float
  48. run_in_parallel
  49. translit
  50. );
  51. BEGIN
  52. {
  53. #---------------------------------------------------------------------------------------------------------
  54. sub log_file {
  55. return if (!$_[0]);
  56. return if (!$_[1]);
  57. return if (!$_[2]);
  58. open (LG,">>$_[0]") || die("Error open log file $_[0]!!! die...");
  59. my ($sec,$min,$hour,$mday,$mon,$year) = (localtime())[0,1,2,3,4,5];
  60. $mon += 1; $year += 1900;
  61. my @msg = split("\n",$_[2]);
  62. foreach my $row (@msg) {
  63. next if (!$row);
  64. printf LG "%04d%02d%02d-%02d%02d%02d %s [%d] %s\n",$year,$mon,$mday,$hour,$min,$sec,$_[1],$$,$row;
  65. }
  66. close (LG);
  67. if ($< ==0) {
  68. my $uid = getpwnam $log_owner_user;
  69. my $gid = getgrnam $log_owner_user;
  70. if (!$gid) { $gid=getgrnam "root"; }
  71. if (!$uid) { $uid=getpwnam "root"; }
  72. chown $uid, $gid, $_[0];
  73. chmod oct("0660"), $_[0];
  74. }
  75. }
  76. #---------------------------------------------------------------------------------------------------------
  77. sub write_to_file {
  78. return if (!$_[0]);
  79. return if (!$_[1]);
  80. my $f_name = shift;
  81. my $cmd = shift;
  82. my $append = shift;
  83. if ($append) {
  84. open (LG,">>$f_name") || die("Error open file $f_name!!! die...");
  85. } else {
  86. open (LG,">$f_name") || die("Error open file $f_name!!! die...");
  87. }
  88. if (ref($cmd) eq 'ARRAY') {
  89. foreach my $row (@$cmd) {
  90. next if (!$row);
  91. print LG $row."\n";
  92. }
  93. } else {
  94. my @msg = split("\n",$cmd);
  95. foreach my $row (@msg) {
  96. next if (!$row);
  97. print LG $row."\n";
  98. }
  99. }
  100. close (LG);
  101. }
  102. #---------------------------------------------------------------------------------------------------------
  103. sub wrlog {
  104. my $level = shift;
  105. my $string = shift;
  106. my $PRN_LEVEL = 'INFO:';
  107. if ($level == $W_INFO) { log_info($string); }
  108. if ($level == $W_ERROR) { $PRN_LEVEL = 'ERROR:'; log_error($string); }
  109. if ($level == $W_DEBUG) { $PRN_LEVEL = 'DEBUG'; log_debug($string); }
  110. my @msg = split("\n",$string);
  111. foreach my $row (@msg) {
  112. next if (!$row);
  113. print $PRN_LEVEL.' '.$row."\n";
  114. }
  115. }
  116. #---------------------------------------------------------------------------------------------------------
  117. sub log_session { log_file($LOG_COMMON,"SESSION:",$_[0]) if ($log_enable); }
  118. #---------------------------------------------------------------------------------------------------------
  119. sub log_info { log_file($LOG_COMMON,"INFO:",$_[0]) if ($log_enable); }
  120. #---------------------------------------------------------------------------------------------------------
  121. sub log_warning { log_file($LOG_COMMON,"WARN:",$_[0]) if ($log_enable); }
  122. #---------------------------------------------------------------------------------------------------------
  123. sub log_debug { log_file($LOG_DEBUG,"DEBUG:",$_[0]) if $debug; }
  124. #---------------------------------------------------------------------------------------------------------
  125. sub log_error { log_file($LOG_ERR,"ERROR:",$_[0]) if ($log_enable); }
  126. #---------------------------------------------------------------------------------------------------------
  127. sub log_die {
  128. wrlog($W_ERROR,$_[0]);
  129. my $worktime = time()-$BASETIME;
  130. log_info("Script work $worktime sec.");
  131. sendEmail("$HOSTNAME - $MY_NAME die! ","Process: $MY_NAME aborted with error:\n$_[0]");
  132. die ($_[0]);
  133. }
  134. #---------------------------------------------------------------------------------------------------------
  135. sub timestamp {
  136. my $worktime = time()-$BASETIME;
  137. log_info("TimeStamp: $worktime sec.");
  138. }
  139. #---------------------------------------------------------------------------------------------------------.
  140. sub do_exec_ref {
  141. my $ret = `$_[0]`;
  142. my $res = $?;
  143. my %result;
  144. chomp($ret);
  145. $result{output}=$ret;
  146. $result{status}=$res;
  147. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  148. if ($res eq "0") { log_info("Run: $_[0] - $ret"); } else { log_error("Run: $_[0] - $ret"); }
  149. return %result;
  150. }
  151. #---------------------------------------------------------------------------------------------------------
  152. sub do_exec {
  153. my $ret = `$_[0]`;
  154. my $res = $?;
  155. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  156. if ($res eq "0") {
  157. log_info("Run: $_[0] - $ret");
  158. } else {
  159. $ret = "Error";
  160. log_error("Run: $_[0] - $ret");
  161. }
  162. return $ret;
  163. }
  164. #---------------------------------------------------------------------------------------------------------
  165. sub do_exit {
  166. my $worktime = time()-$BASETIME;
  167. my $code;
  168. if ($_[0]) { $code = $_[0]; } else { $code = 0; }
  169. log_info("Script work $worktime sec. Exit code: $code");
  170. exit $code;
  171. }
  172. #---------------------------------------------------------------------------------------------------------
  173. sub sendEmail {
  174. my ($subject, $message, $crf) = @_;
  175. return if (!$send_email);
  176. my $sendmail = '/sbin/sendmail';
  177. open(MAIL, "|$sendmail -oi -t");
  178. print MAIL "From: $sender_email\n";
  179. print MAIL "To: $admin_email\n";
  180. print MAIL "Subject: $subject\nMIME-Version: 1.0\nContent-Language: ru\nContent-Type: text/html; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n";
  181. print MAIL '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
  182. print MAIL '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
  183. print MAIL "<head><title>$subject </title></head><body>\n";
  184. my @msg = split("\n",$message);
  185. foreach my $row (@msg) {
  186. if ($crf) { print MAIL "$row<br>"; } else { print MAIL "$row\n"; };
  187. }
  188. print MAIL "</body></html>\n";
  189. close(MAIL);
  190. log_info("Send email from $sender_email to $admin_email with subject: $subject");
  191. log_debug("Body:\n$message");
  192. }
  193. #---------------------------------------------------------------------------------------------------------
  194. ### Check few run script
  195. sub IsNotRun {
  196. my $pname = shift;
  197. my $lockfile = $pname.".pid";
  198. # if pid file not exists - OK
  199. log_debug("Check what pid file $lockfile exists.");
  200. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  201. open (FF,"<$lockfile") or log_die("can't open file $lockfile: $!");
  202. my $lockid = <FF>;
  203. close(FF);
  204. chomp($lockid);
  205. # If the process ID belongs to the current program - OK
  206. if ($lockid eq $$) { log_debug("pid file found, but owner is this process. Continue. "); return 1; }
  207. # if owner of this process ID not exists - OK
  208. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  209. chomp($process_count);
  210. log_debug("Process count with id $lockid is $process_count");
  211. if ($process_count==0) { log_debug("pid file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  212. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  213. return 0;
  214. }
  215. #---------------------------------------------------------------------------------------------------------
  216. sub IsMyPID {
  217. my $pname = shift;
  218. my $lockfile = $pname.".pid";
  219. log_debug("Check what pid file $lockfile exists.");
  220. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  221. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  222. my $lockid = <FF>;
  223. close(FF);
  224. chomp($lockid);
  225. if ($lockid eq $$) { log_debug("pid file is my. continue."); return 1; }
  226. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  227. return 0;
  228. }
  229. #---------------------------------------------------------------------------------------------------------
  230. sub Add_PID {
  231. my $pname = shift;
  232. my $lockfile = $pname.".pid";
  233. log_debug("Try create lock file $lockfile");
  234. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  235. flock(FF,2) or log_die "can't flock $lockfile: $!";
  236. print FF $$;
  237. close(FF);
  238. log_debug("Ok.");
  239. return 1;
  240. }
  241. #---------------------------------------------------------------------------------------------------------
  242. sub Remove_PID {
  243. my $pname = shift;
  244. my $lockfile = $pname.".pid";
  245. log_debug("Check what pid file $lockfile exists.");
  246. if (! -e $lockfile) { log_debug("pid file not exists. Continue."); return 1; }
  247. unlink $lockfile or return 0;
  248. log_debug("pid file $lockfile removed.");
  249. return 1;
  250. }
  251. #---------------------------------------------------------------------------------------------------------
  252. sub IsNotLocked {
  253. my $lockfile = $_[0] . ".lock";
  254. log_debug("Check what lock file $lockfile exists.");
  255. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 1; }
  256. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  257. my $lockid = <FF>;
  258. close(FF);
  259. chomp($lockid);
  260. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  261. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  262. if ($process_count lt 1) { log_debug("lock file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  263. log_debug("Another proceess with pid: $lockid already use $_[0]");
  264. return 0;
  265. }
  266. #---------------------------------------------------------------------------------------------------------
  267. sub IsMyLock {
  268. my $lockfile = $_[0] . ".lock";
  269. log_debug("Check what lock file $lockfile exists.");
  270. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 0; }
  271. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  272. my $lockid = <FF>;
  273. close(FF);
  274. chomp($lockid);
  275. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  276. log_debug("file $_[0] used by process with pid: $lockid");
  277. return 0;
  278. }
  279. #---------------------------------------------------------------------------------------------------------
  280. sub Add_Lock {
  281. if (!IsNotLocked($_[0])) { return 0; }
  282. my $lockfile = $_[0] . ".lock";
  283. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  284. flock(FF,2) or log_die "can't flock $lockfile: $!";
  285. print FF $$;
  286. close(FF);
  287. log_debug("Create lock file for $_[0]");
  288. return 1;
  289. }
  290. #---------------------------------------------------------------------------------------------------------
  291. sub Remove_Lock {
  292. if (!IsNotLocked($_[0])) { return 0; }
  293. my $lockfile = $_[0] . ".lock";
  294. if (! -e $lockfile) { return 1; }
  295. unlink $lockfile or return 0;
  296. log_debug("Lock file for $_[0] removed");
  297. return 1;
  298. }
  299. #---------------------------------------------------------------------------------------------------------
  300. sub DefHash {
  301. my $hash=$_[0];
  302. my $num_list = $_[1];
  303. my %num_keys;
  304. if ($num_list) {
  305. my @ret_num = split(' ',$num_list);
  306. %num_keys = map { $_, 1 } @ret_num;
  307. }
  308. foreach my $key (keys %$hash) {
  309. my $null_value = "";
  310. $null_value = 0 if (defined $num_keys{$key});
  311. $hash->{$key}=$null_value if (!defined($hash->{$key}));
  312. }
  313. return $hash;
  314. }
  315. #---------------------------------------------------------------------------------------------------------
  316. sub read_file {
  317. my $filename = shift;
  318. return if (!$filename);
  319. return if (!-e $filename);
  320. open (FF,"<$filename") or die "unable to open file $filename!" ;
  321. my @tmp=<FF>;
  322. close(FF);
  323. chomp(@tmp);
  324. return @tmp;
  325. }
  326. #---------------------------------------------------------------------------------------------------------
  327. sub AddToConfig {
  328. my $conf_str = $_[0];
  329. my $conf_file = $_[1];
  330. my $res;
  331. eval {
  332. $SIG{ALRM} = sub { die "time-alarm\n" };
  333. alarm $WAIT_TIME;
  334. while (!Add_Lock($conf_file)) {
  335. my $wait = int(rand($MAX_SLEEP));
  336. if ($wait lt $MIN_SLEEP) { $wait = $MIN_SLEEP; }
  337. sleep $wait;
  338. }
  339. my @conf_array=();
  340. @conf_array=read_conf($conf_file);
  341. my %list = map { $_, 1 } @conf_array;
  342. if (exists $list{$conf_str}) { Remove_Lock($conf_file); return 1; }
  343. open(FR,">$conf_file") or log_die "Unable to open config file $conf_file!" ;
  344. flock(FR,2);
  345. push(@conf_array,$conf_str);
  346. print FR "$WARN_MSG";
  347. foreach my $row (@conf_array) { print FR "$row\n"; };
  348. close(FR);
  349. Remove_Lock($conf_file);
  350. $SIG{ALRM} = 'DEFAULT';
  351. };
  352. if ( $@ eq "time-alarm\n" ) {
  353. log_die "Script aborted after timeout $WAIT_TIME sec. Unable to add $conf_str to config file $conf_file...\n";
  354. }
  355. return 1;
  356. }
  357. #---------------------------------------------------------------------------------------------------------
  358. sub RemoveFromConfig {
  359. my $conf_str = $_[0];
  360. my $conf_file = $_[1];
  361. my $res;
  362. eval {
  363. $SIG{ALRM} = sub { die "time-alarm\n" };
  364. alarm $WAIT_TIME;
  365. while (!Add_Lock($conf_file)) {
  366. my $wait = int(rand($MAX_SLEEP));
  367. if ($wait lt $MIN_SLEEP) { $wait = $MIN_SLEEP; }
  368. sleep $wait;
  369. }
  370. my @conf_array=();
  371. @conf_array=read_conf($conf_file);
  372. my %list = map { $_, 1 } @conf_array;
  373. if (!exists $list{$conf_str}) { Remove_Lock($conf_file); return 1; }
  374. my @tmp = grep {/!^$conf_str$/} @conf_array;
  375. open(FF,">$conf_file");
  376. flock(FF,2);
  377. print FF "$WARN_MSG";
  378. foreach my $row (@tmp) { print FF $conf_str ."\n"; };
  379. close(FF);
  380. Remove_Lock($conf_file);
  381. $SIG{ALRM} = 'DEFAULT';
  382. };
  383. 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"; }
  384. return 1;
  385. }
  386. #---------------------------------------------------------------------------------------------------------
  387. sub uniq (\@) {
  388. my @tmp = @{(shift)};
  389. if (scalar(@tmp) eq 0) { return @tmp; }
  390. chomp(@tmp);
  391. my %newlist = map { $_, 1 } @tmp;
  392. return keys %newlist;
  393. }
  394. #---------------------------------------------------------------------------------------------------------
  395. sub strim {
  396. my $str=shift;
  397. return if (!$str);
  398. #$str =~ s/.*[^[:print:]]+//g;
  399. #$str =~ s/[^[:print:]]+//g;
  400. #$str =~ s/[^(a-z|A-Z|0-9|\:|\-|\s|\.)]//g;
  401. #$str =~ s/[:^print:]//g;
  402. $str =~ s/[^[:ascii:]]//g;
  403. $str =~ s/^\s+//g;
  404. $str =~ s/\s+$//g;
  405. return $str;
  406. }
  407. #---------------------------------------------------------------------------------------------------------
  408. sub trim {
  409. my $str=shift;
  410. return if (!$str);
  411. $str =~ s/\n/ /g;
  412. $str =~ s/^\s+//g;
  413. $str =~ s/\s+$//g;
  414. return $str;
  415. }
  416. #---------------------------------------------------------------------------------------------------------
  417. sub is_integer {
  418. defined $_[0] && $_[0] =~ /^[+-]?\d+$/;
  419. }
  420. #---------------------------------------------------------------------------------------------------------
  421. sub is_float {
  422. defined $_[0] && $_[0] =~ /^[+-]?\d+(\.\d+)?$/;
  423. }
  424. #---------------------------------------------------------------------------------------------------------
  425. sub run_in_parallel(\@) {
  426. my @commands = @{(shift)};
  427. my @result = ();
  428. return @result if (!@commands or !scalar(@commands));
  429. my $count = scalar(@commands);
  430. my $start = 0;
  431. while ($start<=$count-1) {
  432. my @run_list=();
  433. my $select = IO::Select->new();
  434. my $stop = $start + $parallel_process_count;
  435. $stop=$count-1 if ($stop >=$count);
  436. for (my $index = $start; $index <=$stop; $index++) {
  437. next if (!$commands[$index]);
  438. my $cmd=$commands[$index];
  439. log_info("Starting ".$cmd);
  440. my ($hchild, $hparent, $childid);
  441. socketpair($hchild, $hparent, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!";
  442. $childid = fork;
  443. die "cannot fork" if($childid == -1);
  444. # redirect child Input|Output
  445. unless($childid) {
  446. # ÐÏÔÏÍÏË
  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. }