Linux: Remove Files older then x days

The other night I had to cleanup a mess in a couple of directories and doing it by date seemed to be the easiest way. I found this command and it worked like a charm:

find /path/to/files* -mtime +5 -exec rm {} \;

Basically use the find command to the files in question, the -mtime function in this example will find files older then 5 days, the last part executes the remove command on file it finds.

Note: Before running this command with the remove code, just run the find part of the command to validate that the files being found are the ones you want to remove (Measure twice cut once!).

PGP/GPG on Linux

Linux is a great platform that has many advantages over a windows based platform, and one of those advantages is PGP (Pretty Good Privacy) available on a base install. In 1991 Phil Zimmermann created the first version of PGP encryption which allows for cryptographic privacy and authentication for data communication. It is widely used for securing email, but can be used to secure texts, files, directories, hard drives, and is now being used to encrypt entire computer systems.

To use PGP, you need to create or import a certificate into the keystore. The keys can be in DSA or RSA formats and have lengths of 1024 to 4096 bits on most systems. The certificates can also be set to never expire or be set to expire within a certain timeframe.

To List Keys in the Keystore:
pgp –list-keys

To Generate a new key:
gpg –gen-key

To Import an existing key:
gpg –import ~/keyfilename.gpg

To Import an existing key secret key:
gpg –allow-secret-key-import –import ~/secretkeyfilename.gpg

When you need to export the data, you will need to remember that there is two parts to the key, the public key, and the secret key. When a client wants to encrypt data for you they will require the public key.

To Export an existing key and secret key:
gpg –output keyfilename_public.gpg –armor –export keyname
gpg –output keyfilename_secret.gpg –armor –export-secret-key keyname

To Encrypt/Decrypt a file, remember the passphrase used, if forgotten your data will remain encrypted forever.

To Encrypt a file:
gpg -c filenametoencrypt (you will be asked for the passphrase to encrypt with).
Non-Interactive:
gpg –yes –passphrase={YourPassPhrase} -c filenametoencrypt

To Decrypt a file:
gpg filenametodecrypt (you will be asked for the passphrase used to encrypt with).
Non-Interactive:
gpg –yes –passphrase={YourPassPhrase} filenametodecrypt

PSUNX Fails To Print – Error “sh: lp: command not found”

This error is caused by the process scheduler (PSUNX) not being able to execute the “lp” program. Typically it is located in the /usr/bin directory. The easiest solution is to simply add this path to the addtopath variable in the process scheduler configuration setup. Typically the cblbin is already there so to append another path simply add it with a “:” colon separator.

AddToPath=/usr/bin:%PS_HOME%/cblbin

Another helpful tip is to make sure the print queues are setup which can be done by entering:

lpstat -t

Tuxedo install error: tuxdirkey

After installing the incorrect version of Tuxedo for Windows, you may encounter an error trying to install the correct version, complaining that the tuxdirkey is already set.

Run the registry editor (regedit) and delete the keyset:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\TUXEDO\

Warning: Changing anything in the registry could cause major system issues, be very careful.

Missing or invalid version of SQL library PSORA

This error is just one that drives you crazy. PeopleSoft has been making the move from a 32bit application to a 64bit application. Almost everywhere you will find the that the application runs in 64bit mode, except for in windows. The client application is still a 32-bit client. So if you are using Oracle for example, you need to ensure that the Oracle client software on the windows machine is 32-bit. This is also true with the tuxedo service, when downloading patches make sure that you download the 32-bit patches.

So if you encounter this error, make sure that the 32-bit libraries are installed and are being referred to for the client. DBBIN variable specifically, and if necessary you may need to add the binary path to the add to path variable in the configuration.