App::cpanel - CLI for cPanel UAPI and API 2
$ cpanel uapi Notifications get_notifications_count
$ cpanel uapi ResourceUsage get_usages
$ cpanel uapi Fileman list_files dir=public_html
$ cpanel uapi Fileman get_file_content dir=public_html file=index.html
$ cpanel download public_html/index.html
$ cpanel api2 Fileman fileop op=chmod metadata=0755 sourcefiles=public_html/cgi-bin/hello-world
$ cpanel api2 Fileman fileop op=unlink sourcefiles=public_html/cgi-bin/hello-world
$ cpanel api2 Fileman mkdir path= name=new-dir-at-top
# this one is one at a time but can overwrite files
$ cpanel api2 Fileman savefile dir=public_html/cgi-bin filename=hello-world content="$(cat public_html/cgi-bin/hello-world)"
# this is multiple files but refuses to overwrite
$ cpanel upload public_html/cgi-bin hello-world
# download
$ cpanel mirror public_html public_html cpanel localfs
# upload
$ cpanel mirror public_html public_html localfs cpanel
CLI for cPanel UAPI and also API 2, due to missing functionality in UAPI.
Stores session token in ~/.cpanel-token
, a two-line file. First line
is the URL component that goes after cpsess
. Second is the cpsession
cookie, which you can get from your browser's DevTools.
Stores relevant domain name in ~/.cpanel-domain
.
Exportable:
Will print the return value, using "dumper" in Mojo::Util except for
download
.
Returns a promise of the decoded JSON value or download
ed content.
Takes $from_dir
, $to_dir
, $from_map
, $to_map
. Copies the
information in the first directory to the second, using the respective
maps. Assumes UNIX-like semantics in filenames, i.e. $dir/$file
.
Returns a promise of completion.
The maps are hash-refs whose values are functions, and the keys are:
Takes $dir
. Returns a promise of two hash-refs, of directories and of
files. Each has keys of relative filename, values are an array-ref
containing a string octal number representing UNIX permissions, and a
number giving the mtime
. Must reject if does not exist.
Takes $dir
. Returns a promise of having created the directory.
Takes $dir
, $file
. Returns a promise of the file contents.
Takes $dir
, $file
. Returns a promise of having written the file
contents.
Takes $path
, $perms
. Returns a promise of having changed the
permissions.
https://documentation.cpanel.net/display/DD/Guide+to+UAPI
https://documentation.cpanel.net/display/DD/Guide+to+cPanel+API+2
Ed J
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.