-
Using the Linux Command Line to Find and Copy A Large Number of Files from a Large Archive, Preserving Metadata
One of my recent challenges is to go through an archive on a NAS and find all of the .xlsx files, then copy them; preserving as much of the file metadata (date created, folder tree, etc) as possible, to a specified folder. After this copy, they will be gone through with another script, to rename…
-
Explicitly Setting log4j Configuration File Location
I ran into an issue recently, where an existing log4j.xml configuration file was built into a jar file I was referencing and I was unable to get Java to recognize another file that I wanted it to use instead. Fortunately, the solution to this problem is fairly straightforward and simple. I was running a standalone…
-
Fixing Performance Problems on Your JBoss Web Apps By Diagnosing Blocked Thread Issues
I was once perplexed by a bizarre performance issue, I encountered at seemingly random intervals, in an application I help to maintain. The application kept freezing up, without any log messages to use for diagnosis. This was very frustrating, because it meant the application server typically had to be restarted manually to restore service. After…
-
Tar/GZip Files in One Operation, Unattached to the Terminal Session
When you’re trying to move a large block of files, its often useful to do so in one command and to be able to close your terminal window (or allow it to time out). If you run a command under normal circumstances, losing the connection can cause your command to terminate prematurely, this is where…
-
Quick and Easy Regular Expression Command/Script to Run on Files in the Bash Shell
I often find it necessary to run regular expressions on, not just one file; but instead a range of files. There are perhaps dozens of ways this can be done, with varying levels of understanding necessary to do this. The simplest way I have encountered utilizes the following syntax: perl -pi -e “s///g” Here is…
-
Monitoring Process Counts and Alerting Via Email
Below is a simple script called monitor_jboss, which checks to see if jboss is running and whether or not too many instances are currently running. I found a need to write this script because we have some cron scripts which automatically restart JBoss each day and the JBoss shutdown script itself sometimes fails to properly…