| 1 | # vim: ft=perl | ||
| 2 | 89 | ▶ | use Ubic::Service::Common; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 89 | ▶ | use Ubic::Daemon qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | my $pidfile = "tfiles/sleeping-common.pid"; | ||
| 6 | |||
| 7 | Ubic::Service::Common->new({ | ||
| 8 | start => sub { | ||
| 9 | my $pid; | ||
| 10 | start_daemon({ | ||
| 11 | function => sub { sleep 100 }, | ||
| 12 | name => 'sleeping-common', | ||
| 13 | pidfile => $pidfile, | ||
| 14 | }); | ||
| 15 | }, | ||
| 16 | stop => sub { | ||
| 17 | stop_daemon($pidfile); | ||
| 18 | }, | ||
| 19 | status => sub { | ||
| 20 | return check_daemon($pidfile); | ||
| 21 | }, | ||
| 22 | custom_commands => { | ||
| 23 | '2plus2' => sub { return 4 }, | ||
| 24 | '3plus3' => sub { return 6 }, | ||
| 25 | }, | ||
| 26 | }); | ||