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,