It is rare that you want to write something without later wanting to be able to read it back. One common way of organizing files that are generated regularly is by time stamp. If you want to add a timestamp to a file name, you can do so using the date command.
In order for the filenames to sort in the right order, you want the name to go from largest unit to smallest.
Here is an example that creates a filename-suitable string formed Year->second. I remove all unnecessary formatting characters.
date --rfc-3339=seconds | sed -E -e 's! |-|:!!g'
The date command reads the current date/time on the local system. –rfc-3339=seconds produces output that looks like this:
$ date --rfc-3339=seconds
In order to keep the regular expression concise inside the sed command, the -E switch tells it to use extended regular expressions, including the alternation character ‘|’ . Thus, the regex ‘ |-|:’ matches a space, a dash, and a colon.
In my quest to automate the testing of the Linux Kernel, I need to automate the build of the Linux Kernel. To build the Kernel, you need the requisite packages. What are they? Let’s find out.
Here’s a one liner for showing the status of all your beaker jobs.
for JOB in $( bkr job-list -o $( bkr whoami | jq -r '.username' ) | jq -r "." ) ; do bkr job-results $JOB | xpath -q -e "string(/job/recipeSet/recipe/@status)" ; done
Ampere Computing chips run the ARM64 instruction set. My laptop is a Dell running x86_64. In order to edit locally, but build remotely, I make use of servers in our datacenter. These are the steps I am taking.
ssh allows you to run a command on a remote machine. You may want to use a shell variable in a remote command. You have to be aware of when that variable gets evaluated.
One of our ironic baremetal nodes was suffering a cleaing failure. Fixing it was easy…once we knew the cause/
Enough of us are looking at the cluster that I want an easy to read snapshot of the node state. So, I convert the csv output of the openstack command into a simple HTML table.
Some custom jq for RegEx selection of OpenStack Ironic baremetal nodes. Our Server types show up in their names. I want to be able to build lists of only the Mt. Jade Servers, which have names that look like this:
openstack baremetal node list --sort provision_state:asc -c UUID -c Name -f json | jq '. | select(.Name | test("jade."))'
While I tend to think about the nodes in OpenStack term, the people that physically move the servers around are more familiar with their IPMI address. We have several nodes that are not responding to IPMI requests. Some have been put into the manageable state, some are in error.
Here’s the query I used to list them.
If an OpenStack server (Ironic or Nova) has an error, it shows up in a nested field. That field is hard to read in its normal layout, due to JSON formatting. Using jq to strip the formatting helps a bunch
The nested field is fault.details.
The -r option strips off the quotes.