System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Migration of scripts from HP unix to Redhat

Rohit Khaladkar
Occasional Contributor

Migration of scripts from HP unix to Redhat

Hi,
I have a set of scripts which needs to be migrated from HP unix to Redhat Linux.

I was wondering if anyone has done this before and if they have a list of commands which work on HP unix but need a change on redhat linux.
6 REPLIES
Torsten.
Acclaimed Contributor

Re: Migration of scripts from HP unix to Redhat

IMHO there is no other advise than read the script line by line, understand what and how it does and make changes if necessary.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
David Claypool
Honored Contributor

Re: Migration of scripts from HP unix to Redhat

I'm assuming you mean shell scripts, and the standard shell in HP-UX is the POSIX shell. On Linux, the standard shell is BASH which claims POSIX compliance. Some sources indicate that the addition of the line:

#!/bin/bash

...at the beginning of a shell that originates elsewhere and now is being run on a Linux system with the BASH shell will improve compatibility.

You could also try executing your scripts with the Korn shell which is available on your RedHat distro (check for /bin/ksh but you may have to add it manually if your kickstart didn't call for it). If you've added the line as suggested above, you'll either need to delete it or change the reference to /bin/ksh.

Keep in mind that any references to devices or filesystems in the script will need to be changed because these references will be different and will need to be changed. For example, a command to mount a CD-ROM in HP-UX might be:

mount /dev/dsk/c1t2d0 /cdrom

...although that can be dependent on the specific system and the controller the CD-ROM exists on. In RHEL the command would be:

mount /dev/cdrom

...because you can let it default to the directory /media/cdrom as a mountpoint, although you can specify any valid directory path you want.

Your scripts should have a high degree of portability using the recommendations above, but you should scan through them for examples of references like the CD-ROM one.
Elmar P. Kolkman
Honored Contributor

Re: Migration of scripts from HP unix to Redhat

Migration of scripts in it self is not hard, but a script is a set of command-line tools. And HP-UX has commands that are not available on Linux. Or commands respond in a different way.

So what you need to do is to scan the scripts for OS-specific commands ('bdf', for instance, is not available on Linux. And 'top' or 'df' respond in a different way. And then I haven't begun about the different behaviour of some of the LVM commands.).

What I do in most cases: create a new script on the linux environment and use the knowledge/algorithm used on the HP-UX environment. But only if it uses HP-UX specific commands.
Every problem has at least one solution. Only some solutions are harder to find.
Rohit Khaladkar
Occasional Contributor

Re: Migration of scripts from HP unix to Redhat

Thanks guys! All the information above helps!
dirk dierickx
Honored Contributor

Re: Migration of scripts from HP unix to Redhat

most of the time when i create scripts i make sure they run on all platforms. this is not as hard to do, depending on what you want to accomplish ofcourse.

i always write my scripts using 'sh', the most basic shell there is, but it is available everywhere (at least hpux, solaris & linux - which matters to me).

then in the first lines detect the OS and then i set all commands and their options depending on the OS type.

then in your script, you can just call the variable which will then run the correct command for that os.
Aditya_amd
Occasional Visitor

Re: Migration of scripts from HP unix to Redhat

Hi all,

I also want to migrate my scripts from hp machine to linus machine..

Do anybody is having some document where I can find almost all the differences as I have to prepare a Valid document...:)