Feb 082014


Depending on policy configuration, services may only be allowed to run on certain port numbers. Attempting to change the port a service runs on without changing policy may result in the service failing to start. Runsemanage port -l | grep -w “http_port_t” as the root user to list the ports SELinux allows httpd to listen on:

# semanage port -l | grep -w http_port_t
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443

By default, SELinux allows http to listen on TCP ports 80, 443, 488, 8008, 8009, or 8443. If/etc/httpd/conf/httpd.conf is configured so that httpd listens on any port not listed for http_port_t, httpd fails to start.

To configure httpd to run on a port other than TCP ports 80, 443, 488, 8008, 8009, or 8443:

  1. Edit /etc/httpd/conf/httpd.conf as the root user so the Listen option lists a port that is not configured in SELinux policy for httpd. The following example configures httpd to listen on the IP address, and on port 12345:

  2. # Change this to Listen on specific IP addresses as shown below to
    # prevent Apache from glomming onto all bound IP addresses (

  3. Run semanage port -a -t http_port_t -p tcp 12345 as the root user to add the port to SELinux policy configuration.

  4. Run semanage port -l | grep -w http_port_t as the root user to confirm the port is added:

  5. # semanage port -l | grep -w http_port_t
    http_port_t                    tcp      12345, 80, 443, 488, 8008, 8009, 8443

If you no longer run httpd on port 12345, run semanage port -d -t http_port_t -p tcp 12345 as the root user to remove the port from policy configuration.


Jan 192014

You will be prompted for your credentials after each command.
Generate tab delimited output (Default):

mysql databasename -u username -p < test.sql > output.tab

Generate XML Output:

mysql databasename -u username -p --xml < test.sql > output.xml

This method puts all the commands on one line.

mysql -u username -p --xml -e 'use databasename; select * from tablename' > output.xml

You can also put the db_name in your script to avoid typing it on the command line.

mysql -u username -p --xml < test.sql > output.xml

To Dump a database to a file and generate full insert statments:

mysqldump -p -c -e databasename > DatabaseName.sql

To dump a table from a database and generate full insert statements:

mysqldump -p -c -e databasename tablename > TableName.sql

To dump all databases on the database server:

mysqldump -p -c -e --all-databases > AllDatabases.sql

The contents of test.sql without the database name.

select * from tablename order by columnName;

The contents of test.sql with the database name.

use database;
select * from tablename order by columnName;
Jan 092014

How do I convert between Unix and Windows text files?

The format of Windows and Unix text files differs slightly. In Windows, lines end with both the line feed and carriage return ASCII characters, but Unix uses only a line feed. As a consequence, some Windows applications will not show the line breaks in Unix-format files. Likewise, Unix programs may display the carriage returns in Windows text files with Ctrl-m ( ^M ) characters at the end of each line.

There are many ways to solve this problem. This document provides instructions for using FTP, screen capture, unix2dos and dos2unix, tr, awk, Perl, and vi to do the conversion. To use these utilities, the files you are converting must be on a Unix computer.

Note: In the instructions below, replace unixfile.txt with the name of your Unix file, and replace winfile.txt with the Windows filename..

When using an FTP program to move a text file between Unix and Windows, be sure the file is transferred in ASCII format, so the document is transformed into a text format appropriate for the host. Some FTP programs, especially graphical applications (e.g., Hummingbird FTP), do this automatically. If you are using command line FTP, before you begin the transfer, enter:

Note: You need to use a client that supports secure FTP to transfer files to and from Indiana University’s central systems. For more, see At IU, what SSH/SFTP clients are supported and where can I get them?

dos2unix and unix2dos
The utilities dos2unix and unix2dos are available for converting files from the Unix command line.

To convert a Windows file to a Unix file, enter:

dos2unix winfile.txt unixfile.txt

To convert a Unix file to Windows, enter:

unix2dos unixfile.txt winfile.txt

You can use tr to remove all carriage returns and Ctrl-z ( ^Z ) characters from a Windows file:

tr -d '\15\32' < winfile.txt > unixfile.txt

However, you cannot use tr to convert a document from Unix format to Windows.

To use awk to convert a Windows file to Unix, enter:

awk '{ sub("\r$", ""); print }' winfile.txt > unixfile.txt

To convert a Unix file to Windows, enter:

awk 'sub("$", "\r")' unixfile.txt > winfile.txt

Older versions of awk do not include the sub function. In such cases, use the same command, but replace awk with gawk or nawk.

To convert a Windows text file to a Unix text file using Perl, enter:

perl -p -e 's/\r$//' < winfile.txt > unixfile.txt

To convert from a Unix text file to a Windows text file, enter:

perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt

You must use single quotation marks in either command line. This prevents your shell from trying to evaluate anything inside.

In vi, you can remove carriage return ( ^M ) characters with the following command:


Note: To input the ^M character, press Ctrl-v , and then press Enter or return.
In command mode in the vi editor I have also used Ctrl-v to get the “^” and then Ctrl-M to get the “M”. Example:
:%s/^M//g inside the vi editor to remove the ^M characters.

The same works for ^[ inside the vi editor. Ctrl-V and Ctrl-[ to get “^[” next to
each other. Example find and replace: :%s/^[//g will remove the ^[ characters from
your document in the vi editor.

In vim, use :set ff=unix to convert to Unix; use :set ff=dos to convert to Windows.

Recursive conversion of files

To recursively convert text files in a directory tree, use dos2unix in combination
with the ‘find’ and ‘xargs’ commands.

For instance to convert all .txt files under 
the current directory type:

find . -name *.txt |xargs dos2unix

Source for most of this document.

Jan 082014

Subject: 405078750 Service Record Update; Clt Ref Id#:

Hello XXXXX –

When a MPage is executed from PowerChart, it calls server 79 (CPM Script MPages). Some clients have a startup script on the 79 server that sets a rec-persist command. If this is set, it could be causing the request/reply structure used in your page to contain invalid data or not qualify as expected. CR# 1-7329965061 addresses this issue, and the fix is to change the startup script on EACH backend node of each affected domain:

1. In CCL, compile the following script.


2. In SCP, modify server 79 to use CPMSTARTUP_MPAGE on all nodes

scp> modify 79 -prop "startup script"=mPage

3.  After performing the previous step, cycle all instances of server 79

scp> cycle -entry 79

You may also take package 69219 to address this potential issue.
Another option may be to free your record structure prior to declaring it in your script.

When you have a chance to run the query, let me know if it resolves the issue.

Thank you,

Dec 212013
RAR help with Linux functions included
RAR 4.20   Copyright (c) 1993-2012 Alexander Roshal   9 Jun 2012
Registered to = Robert Holland =

Usage:     rar <command> -<switch 1> -<switch N> <archive> <files...>
               <@listfiles...> <path_to_extract\>

  a             Add files to archive
  c             Add archive comment
  cf            Add files comment
  ch            Change archive parameters
  cw            Write archive comment to file
  d             Delete files from archive
  e             Extract files to current directory
  f             Freshen files in archive
  i[par]=<str>  Find string in archives
  k             Lock archive
  l[t,b]        List archive [technical, bare]
  m[f]          Move to archive [files only]
  p             Print file to stdout
  r             Repair archive
  rc            Reconstruct missing volumes
  rn            Rename archived files
  rr[N]         Add data recovery record
  rv[N]         Create recovery volumes
  s[name|-]     Convert archive to or from SFX
  t             Test archive files
  u             Update files in archive
  v[t,b]        Verbosely list archive [technical,bare]
  x             Extract files with full path

  -             Stop switches scanning
  @[+]          Disable [enable] file lists
  ad            Append archive name to destination path
  ag[format]    Generate archive name using the current date
  ai            Ignore file attributes
  ap<path>      Set path inside archive
  as            Synchronize archive contents
  av            Put authenticity verification (registered versions only)
  av-           Disable authenticity verification check
  c-            Disable comments show
  cfg-          Disable read configuration
  cl            Convert names to lower case
  cu            Convert names to upper case
  df            Delete files after archiving
  dh            Open shared files
  ds            Disable name sort for solid archive
  dw            Wipe files after archiving
  e[+]<attr>    Set file exclude and include attributes
  ed            Do not add empty directories
  en            Do not put 'end of archive' block
  ep            Exclude paths from names
  ep1           Exclude base directory from names
  ep3           Expand paths to full including the drive letter
  f             Freshen files
  hp[password]  Encrypt both file data and headers
  id[c,d,p,q]   Disable messages
  ierr          Send all messages to stderr
  ilog[name]    Log errors to file (registered versions only)
  inul          Disable all messages
  isnd          Enable sound
  k             Lock archive
  kb            Keep broken extracted files
  log[f][=name] Write names to log file
  m<0..5>       Set compression level (0-store...3-default...5-maximal)
  mc<par>       Set advanced compression parameters
  md<size>      Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)
  ms[ext;ext]   Specify file types to store
  mt<threads>   Set the number of threads
  n<file>       Include only specified file
  n@            Read file names to include from stdin
  n@<list>      Include files listed in specified list file
  o[+|-]        Set the overwrite mode
  ol            Save symbolic links as the link instead of the file
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  p-            Do not query password
  r             Recurse subdirectories
  r-            Disable recursion
  r0            Recurse subdirectories for wildcard names only
  rr[N]         Add data recovery record
  rv[N]         Create recovery volumes
  s[<N>,v[-],e] Create solid archive
  s-            Disable solid archiving
  sc<chr>[obj]  Specify the character set
  sfx[name]     Create SFX archive
  si[name]      Read data from standard input (stdin)
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  t             Test files after archiving
  ta<date>      Process files modified after <date> in YYYYMMDDHHMMSS format
  tb<date>      Process files modified before <date> in YYYYMMDDHHMMSS format
  tk            Keep original archive time
  tl            Set archive time to latest file
  tn<time>      Process files newer than <time>
  to<time>      Process files older than <time>
  ts<m,c,a>[N]  Save or restore file time (modification, creation, access)
  u             Update files
  v             Create volumes with size autodetection or list all volumes
  v<size>[k,b]  Create volumes with size=<size>*1000 [*1024, *1]
  ver[n]        File version control
  vn            Use the old style volume naming scheme
  vp            Pause before each volume
  w<path>       Assign work directory
  x<file>       Exclude specified file
  x@            Read file names to exclude from stdin
  x@<list>      Exclude files listed in specified list file
  y             Assume Yes on all queries
  z[file]       Read archive comment from file

Profile Functions: 
splitrar() {
if [ $# -eq 0 ]
echo "Usage: splitrar rarname.rar FileToBeSplit"
echo "Splitting... " $2
rar a -r -v1440k -s -rr $1 $2

listrar() {
if [ $# -eq 0 ]
echo "Usage: listrar rarname.rar"
echo "Listing... " $1
rar vt $1

makerar() {
if [ $# -eq 0 ]
echo "Usage: makerar rarname.rar filestobearchived"
echo "Creating... " $1
rar a -r -rr $1 $2

Rar () {
#Make an encrypted and password protected one also.
echo "Type the rarname without the extension followed by a space and the file(s) to be archived separated by a space."
echo "Example: NameOfRAR file1 file2 directory1/ directory2/"
read rarname filenames
rar a -r -rr "Backup.Of."$rarname.`date +"%Y%m%d%H%M%S%Z"`.rar $filenames
RarE () {
#Make an encrypted and password protected one also.
echo "Type the rarname without the extension followed by a space and the file(s) to be archived separated by a space."
echo "Example: NameOfRAR file1 file2 directory1/ directory2/"
echo "You will be prompted to enter the password for the archive."
read rarname filenames
rar a -r -rr -hp "Backup.Of."$rarname.`date +"%Y%m%d%H%M%S%Z"`.rar $filenames