To extract a file path or filename from a full path, you can use various utilities like grep, sed, awk, etc. If it’s not a list from a file or variable, you can use find, but there’s an easier way: basename – returns the filename dirname – returns the path to the file Example: … Continue reading " Linux – Get path and filename from full path"
Key "–environment" AWS Cli utility replaces all the variables, those that you specify as an argument. To change the value of only one variable without erasing the others, or without listing them all, you can use the following BASH script: aws_lambda_update_env.sh: This script requires jq utility The script reads all current variables, changes … Continue reading "AWS Cli – Lambda: Update single variable value"
If you need to execute the FOR loop the N number of times, and this value will be set by a variable, the script will look like this:
For example, there is a file "/home/artem/IP" with IP addresses on which you want to execute a remote command, the FOR loop will look like this:
For example, there is the N number of variables, "var_1", "var_2" and so on, the script takes as arguments only the number of the variable, and its contents should be in the new var variable. If you execute this script, passing it as argument "1": my_script.sh That script will return: var_1 … Continue reading " BASH – The variable content of which refers to another variable"
To display the copy status using the "dd" utility, the "status = progress" key is used, but in the old version of "dd" this key is not yet available, so you can use the "pv" utility to see progress Example:
Find all the directories that are on the path "/home/artem" and set them with the standard rights to the directory "755", also find all the files and set the rights "644" Not all directories use the rights "755", for example for the directory ".ssh" the rights "600" are necessary
This line checks the change of the "configmap.yml" file between the last and the last but one commit, if there was a change in it, then the configmap update in Kubernetes is performed.
The script finds all folders in a given directory and archives them one by one, copies them to S3 Bucket and deletes them locally. It also receives a list of all MySQL databases, excluding system databases, archives them in turn, sends them to S3 Bucket and deletes them locally.