Created
May 1, 2012 16:08
-
-
Save berekuk/2569196 to your computer and use it in GitHub Desktop.
trivial ubic-web
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| use Dancer; | |
| use Ubic; | |
| my @commands = qw( start stop status restart try-restart reload force-reload); | |
| post '/:service/:command' => sub { | |
| my $service = param('service'); | |
| my $command = param('command'); | |
| my $result; | |
| if (grep { $_ eq $command } @commands) { | |
| $result = Ubic->$command($service); | |
| } | |
| else { | |
| $result = Ubic->do_custom_command($service, $command); | |
| } | |
| return "$result"; | |
| }; | |
| dance; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment