Linux tar: Cannot change ownership to [..]: Permission denied

In a script I was working on, the tar command always reported the following error when I tried to extract an archive:

Cannot change ownership to uid 1000 , gid 1000: Permission denied

But I was executing the script as root! The reason for this error to occur turned out to be relatively simple. Hint: It has to do with CIFS.

Read the rest of this entry

WMIC on Linux examples

In a previous post I showed how to install the Windows Management Instrumentation (WMI) client for Linux (wmic). In this post, I wish to show a few ways on how to query a Windows-based host using the WMI client.

Using WQL, we can query almost any aspect of the Operating System. Using the available WMI Classes (for example the WMI Win32 Classes), we can easily query performance indicators such as Memory Usage, Disk Usage or the status of a certain process.

Read the rest of this entry

BASH: here-document at line n delimited by end-of-file (wanted `EOF’)

On one of our Debian hosts, we use bash scripts and cron jobs to automate certain tasks. One of these bash scripts downloads files from an FTP server and archives them. After upgrading the host machine to Debian 6.0.4, one of the bash scripts suddenly showed warnings:

/srv/foo/bar.sh: line 146: warning: here-document at line 140 delimited by end-of-file (wanted `EOF')

Whoops, so let’s look into it. The change was probably introduced with the new version of bash:

Read the rest of this entry

Oracle Full Datapump Export Batch

On a few test databases, test managers often need to preserve certain states in the database. This is why we use daily datapump scripts to create exports for archival.

It is important to note that such scripts are never a replacement for a proper RMAN backup, but an easy way to preserve multiple states of a database and reuse data where applicable.

This batch file uses the expdp tool provided by Oracle and the 7-zip archiver to compress the exports for archival. The export tool itself creates a full export of the whole database (full=y). Also, the flashback_time parameter is specified to get a consistent export.

Read the rest of this entry

Automating Database Startup and Shutdown on Red Hat Enterprise Linux

Well, I was quite busy before the holidays, but here is another post I just keep for my reference.

For each database, I believe it is important to automate database shutdown and database startup. This way, in case of an emergency, a systems administrator can start and stop database services without the need for a database administator. Oracle provides an excellent article on this topic, but the Oracle documentation is quite generic. So I hereby provide a step-by-step guide for Red Hat Enterprise Linux (RHEL).

Read the rest of this entry

BASH: Wait for log entry

For a startup script, I needed to start JBoss and start another component as soon as the complete JBoss server was started. When you execute the “run.sh” script that comes with JBoss, it immediately exits and starts JBoss in the background (which is quite nice I think). Unfortunately, when I started the other component using this method, the additional program was unhappy, since JBoss was not ready yet. So I had to come up with a trick to delay the start of the additional program.

So with the help of the internet and my co-worker, we came up with the following script:

Read the rest of this entry

BASH Setup in Solaris 10

Coming from Linux distributions where BASH is usually already set up and configured, I had to find my way around in a UNIX environment first. So here I present the files necessary for a proper installation of BASH under Solaris 10 (yes, I know Solaris 11 Express is out :)).

So after installing the BASH package (see my other post on setting up Solaris), you might find your new shell to be kinda boring. Also, it simply shows up as bash-3.00#, which by itself does not tell you a lot. So lets improve it a bit.

Read the rest of this entry

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab