nk_toolkit
Introduction
nk_toolkit is a collection of functions that aim to make admin life a bit easier. Please note that this is a working prototype and not a full release.
If you have any questions or feedback please reach to me on Slack @nkernreicht
Install
nk_toolkit can be used on any linux server, however these scripts are made for WHM/CPanel and should not be used on other servers yet. Once you are root on a server, simply enter in the following command.
source <(curl -u "lwadmin:1UtwkK4HKNV" https://nkern.net/nk_toolkit.sh)
That’s it you’re all set, you can now use any of the commands available in nk_toolkit. Because this tool runs off your current bash session, it leaves behind no files and the commands will no longer be available once you log out.
Available Commands
Here are some of the commands available and how to use them. Note: the commands link to their respective pages.
Command | Description |
---|---|
nk_docroot | Provides docroot for given domain |
nk_php_version | Provides php verion for a give domain. |
nk_user | Get the username for a provided domain. |
nk_enable_fpm | Enabled PHP FPM on a given domain |
nk_sarmaxes | Print the highest Load and Memory usage from sar logs |
nk_list_all_domains | List all domains on the server |
nk_ttfb | Get the time to first byte of a domain |
nk_ttfb_all | Get the time to first byte of all domains on the server |
nk_response_codes | Get the HTTP resonse codes for all sites on the server |
nk_all_docroots | List all document roots on a server |
nk_email_disk_usage | List email addresses with the highest disk usage |
nk_fpm_stats | List PHP-FPM config information |
nk_cdd | Move to docroot of provided domain |
nk_list_all_wp | List all WP sites on the server |
nk_robots_check | Check for the presence of robots.txt, xmlrpc-blocks, and wp-cron status for all domains |
nk_xmlrpc_block | Block xmlrpc in htaccess for a given site |
nk_create_robots_txt | Creates a robots.txt for a domain with crawl delay of 10 |
nk_csf_load_threshold | Adjusts the LFD alert threshold. |
nk_curl_bypass_cloudflare | Get curl headers from a domain by bypassing CloudFlare. Works similar to an /etc/hosts file |
nk_logs_from_timestamps | Get combined domlog info for a domain given a timestamp. Works even if logs are archived |
nk_top_ips | Get information about the top IPs hitting a domain |
nk_traffic_break_down | Display traffic information for all domains. |
nk_load_watch_from_lfd_notifications | Find loadwatch logs closest to LFD notifcation emails |
nk_wp_cron_disable | Disable wp-cron and add matching system cron. Update if wrong version |
nk_help | Print link to documentation |
nk_percent | Get the percent of two values. |
nk_base_stats | Generate basic stats for the server. |
nk_extract_tar_gz | Extract a tar.gz file without remembering all the flags |
nk_wp_admin_create | Creates a wp admin for a wordpress install. Auto expires |
nk_php_ini_stats | Find if there’s php.ini files present for a domain |
nk_list_all_users | List all the CPanel users. |
nk_user_disk_usage | Get disk Usage for all users. |
nk_domain_disk_usage | Get disk usage for all domains. |
nk_memory_by_users | Get the current memory usage for all users on the system |
IDEAS
There’s a page dedicated to ideas / scripts in progress. You can view it here.