added ngircd-ctl script
This commit is contained in:
parent
25123376b3
commit
bd187d6964
32
perl-script/ngircd-ctl.pl
Normal file
32
perl-script/ngircd-ctl.pl
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my @MY_ARGV = @ARGV;
|
||||
my $MY_ACMD = shift;
|
||||
|
||||
my $NGIRCD='ngircd';
|
||||
my $NGIRCD_UID = 703;
|
||||
my $NGIRCD_UN = "_ngircd";
|
||||
|
||||
my $ERROR = 0;
|
||||
|
||||
my $USAGE = "Usage: ngircd-ctl (start|status|stop)";
|
||||
my $PERM_ERR = "must run as $NGIRCD_UN\nplease run using: doas -u $NGIRCD_UN\n";
|
||||
|
||||
unless( getpwuid( $< ) =~ /$NGIRCD_UN/ ){
|
||||
die $PERM_ERR;
|
||||
}
|
||||
|
||||
if ($MY_ACMD eq "stop"){
|
||||
$ERROR = system("pkill -u $NGIRCD_UID -x $NGIRCD");
|
||||
}elsif($MY_ACMD eq "start"){
|
||||
$ERROR = system("$NGIRCD");
|
||||
}elsif($MY_ACMD eq "status"){
|
||||
$ERROR = system("rcctl check $NGIRCD");
|
||||
}elsif($MY_ACMD eq "help"){
|
||||
printf("$USAGE\n");
|
||||
}else{
|
||||
printf("$USAGE\n");
|
||||
}
|
Loading…
Reference in New Issue
Block a user