Guest User

Untitled

a guest
May 16th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5.  
  6. package head;
  7.  
  8. use Daemon::Generic;
  9. use Config::General;
  10.  
  11. sub gd_run {
  12. main->init();
  13. }
  14.  
  15. sub gd_preconfig {
  16. my $conf = new Config::General(tools->selconf());
  17. return;
  18. }
  19.  
  20.  
  21. newdaemon(
  22. progname => 'altLaunch',
  23. pidfile => '/tmp/altLaunch.pid',
  24. configfile => '/usr/local/etc/altLaunch/altLaunch.conf',
  25. );
  26.  
  27. package tools;
  28.  
  29. sub selconf {
  30. my @configs = qw(/etc/altLaunch/altLaunch.conf /usr/local/etc/altLaunch/altLaunch.conf);
  31. foreach my $path (@configs) { return $path if (-e $path) }
  32. die "Could not find a valid configuration file, searched: [".join(',',@configs)."]";
  33. }
  34.  
  35. package main;
  36.  
  37. use POE;
  38.  
  39. sub init {
  40. sleep 20;
  41. }
  42.  
  43. exit 0;
  44.  
  45.  
  46.  
  47. "altLaunch" 43 lines, 711 characters
  48. > perl altLaunch start
  49. Could not find a valid configuration file, searched: [/etc/altLaunch/altLaunch.conf,/usr/local/etc/altLaunch/altLaunch.conf] at altLaunch line 32.
  50. >
Add Comment
Please, Sign In to add comment