diff --git a/initify.pl b/initify.pl index 7cec3d2..3d8b1bd 100755 --- a/initify.pl +++ b/initify.pl @@ -14,7 +14,8 @@ my @cmds_start = (); my @cmds_stop = (); my $pidfile = ""; my $desc = ""; -(my $service=$ARGV[0])=~s/\.service//; +(my $service = $ARGV[0]) =~ s/\.service//; +(my $svc_name = $ARGV[0]) =~ s|(.*/)?([^/.]*)\.service|$2|; my %opt; GetOptions(\%opt, @@ -23,7 +24,7 @@ GetOptions(\%opt, pod2usage() if ($opt{help}); -$service = $opt{name} if (length $opt{name}); +$svc_name = $opt{name} if (length $opt{name}); while(<>) { #s/\s*|\s*$//g; # Trim whitespace @@ -77,7 +78,7 @@ command=$cmd_path[0] command_args="$cmd_argl[0]" pidfile=$pidfile -name="$service" +name="$svc_name" description="$desc" EOF