Here is a quick and dirty shell script I put to check LXD container size and how much space they are taking on the BTRFS subvolume. Naturally, you must run the script as a root user, and LXD must be configured with BTRFS storage backend on Linux operating systems. See how to set up and install LXD on Ubuntu 20.04 LTS using the apt command
[continue reading…]
A content delivery network or content distribution network (CDN) is a system of servers containing copies of data, placed at various points in a network so as to maximize bandwidth for access to the data from clients throughout the network. Please note that the following script will only work with Stackpath CDN. You need to get API access keys using stackpath portal.
[continue reading…]
Here is a handy and useful Linux and Unix shell script that reduce PDF file size using Ghostscript. No need to upload your PDF file to the shady third-party website. Just do it from the terminal. I tested it with both CentOS and Ubuntu/Debian Linux.
[continue reading…]
A sample shell script to build an LXD (Linux Containers) VM lab on Ubuntu Linux 16.04 or 18.04 LTS server.
[continue reading…]
A shell script mirror remote server named server1.cyberciti.biz and /backups directory to another server. The script use rsync command and also make sure a special directory mounted in local server. You must setup ssh keys (see “How To Set Up SSH Keys” for more info).
#!/bin/bash # Purpose: Mirror remote server backup using rsync command # Author: Vivek Gite {https://www.cyberciti.biz/} # License: GPL ver 2.x+ # Note: Tested on Debian/Ubuntu and CentOS only. # ------------------------------------------------------------ ## change me ## _mnt="/dev/mapper/offsite-backups" _user="vivek" _host="server1.cyberciti.biz" _dir="/backups" _dest="/offsite-backups/mirror.${_host}" # Make sure offsite backup directory mounted mount | grep -q ${_mnt} if [ $? -eq 0 ] then # Make dir if not found [ ! -d "$_dest" ] && mkdir -p "${_dest}" # alright mirror it. make sure you setup ssh-keys rsync --bwlimit 10000 --delete -P -az -H --numeric-ids ${_user}@{_host}:${_dir} ${_dest} else echo "$0: Error '${_dest}' not mounted." exit 999 fi
Here is a simple and easy to use bash shell script to purge/delete Cloudflare url/images cache from the command line without using web interface.
[continue reading…]
Cloudflare is a CDN, DNS, WAF, DDoS protection, and reverse proxy service. You need to use the ngx_http_realip_module module to change the client address sent in the specified header field such as CF-Connecting-IP or X-Forwarded-For. This shell script downloads a list of IPv4 and IPv6 address from Cloudflare and generates an updated /etc/nginx/cloudflare.real.ip.conf file:
[continue reading…]
Ebtables is an application program used to set up and maintain the tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is analogous to the iptables application, but less complicated, due to the fact that the Ethernet protocol is much simpler than the IP protocol. ebtables used with bridges on Linux. The following script will stop and clean all ebtables rules:
[continue reading…]
A simple shell script wrapper to update all lxd container hypervisor images eitehr running Debian or Ubuntu Linux.
[continue reading…]