1
  "   ˆl–Ðz¾”Jj"TÒ�zàœ¸”Å£Äƒ/‡ÀÆ o    #!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/syslog_check                    Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use Cpanel::SafeRun::Errors ();

alarm(120);    #prevent hang on total failure

my $has_syslog;
foreach my $service ( 'syslogd', 'rsyslogd' ) {
    my $output = Cpanel::SafeRun::Errors::saferunallerrors( '/usr/local/cpanel/scripts/restartsrv_' . $service, '--check' );
    if ( !$output ) {
        print "syslog_check: passed\n";
        $has_syslog = 1;
        last;
    }
}

exit if $has_syslog;

require Sys::Syslog;
import Sys::Syslog qw(:DEFAULT setlogsock);

Sys::Syslog::openlog( 'cpanel_syslog_test', "ndelay,pid", "local0" )                                                                                                                                       || do { print "test_syslog: failed\n"; exit; };
Sys::Syslog::syslog( 'info', 'This is a test message added by cPanel to ensure syslog is running.  Please disregard this message. For more information please see /usr/local/cpanel/scripts/' . __FILE__ ) || do { print "test_syslog: failed\n"; exit; };
Sys::Syslog::closelog();

print "syslog_check: passed\n";
     �ÈÀÆ      File not found.
     ˆ¾Ä„BÀÆ +i    #!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/cpuser_service_manager          Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

package scripts::cpuser_service_manager;

use App::CmdDispatch;

my $cmds = {
    add => {
        code     => \&add,
        clue     => "add <service_name> --init-script=<ABS_PATH> (or --ubic-service=<ABS_PATH>)",
        abstract => "Setup a service",
        help     => "Setup the given user managed and monitored service",
    },
    rem => {
        code     => \&rem,
        clue     => "rem <service_name>",
        abstract => "Remove a service",
        help     => "Remove the given user managed and monitored service",
    },
    list => {
        code     => \&list,
        clue     => "list",
        abstract => "List your services",
        help     => "List your user managed and monitored services",
    },
    info => {
        code     => sub { my ( $app, @args ) = @_; die "too many arguments\n" if @args; print <DATA> },    # simplify PATH info w/ CPANEL-22345 fix when available
        clue     => "info",
        abstract => "Info on this tool/feature",
        help     => "Information about how this works and what you can do after a service is added",
    },
};

my $hint_blurb = "This tool supports the following commands (i.e. $0 {command} â€¦):";
my $opts       = {
    'help:pre_hint'  => $hint_blurb,
    'help:pre_help'  => "Add/Remove/List user managed and monitored services.\n\n$hint_blurb",
    default_commands => "help",
    alias            => { remove => "rem" },
};

run(@ARGV) if !caller;

sub run {
    my (@argv) = @_;
    local $ENV{TERM} = $ENV{TERM} || "xterm-256color";    # non-CLI modulino avoid needless: Cannot find termcap: TERM not set at â€¦/Term/ReadLine.pm line 373.
    return App::CmdDispatch->new( $cmds, $opts )->run(@argv);
}

################
#### commands ##
################

sub add {
    my ( $app, $service_name, @flags ) = @_;

    eval {
        require Ubic;                                # this means ubic-admin is installed
        require Ubic::Service::InitScriptWrapper;    # this means the --init-script setup will work
    };
    if ($@) {
        die "Ubic must be installed to add a service!\n";
    }

    $service_name = _validated_service_name( $app, $service_name );

    my $service_dir = _get_service