Co-existence of Solaris and Linux computers
Currently, CDS computing environment is a mixture of Solaris and Linux (32/64bit) computers. Since they are similar but not identical, our scripts, medm screens have to be able to work in the both environments. Old scripts, medm screens were written mostly for Solaris, we have to modify those to be able to run on Linux. Moreover, since we still have Solaris machines, these modifications should not prevent execution of the scripts on Solaris.
Here, tips for how to happily make those two environments live together will be presented.
Solaris only apps
Sometimes, a program called 'nedit' is called from medm screen, to display a text file. nedit usually does not exist in linux machines. This is why some buttons fail on linux machines. So I made symbolic links from /usr/bin/gedit to /cvs/cds/caltech/apps/linux64/bin/nedit and /cvs/cds/caltech/apps/linux/bin/nedit. These links are only visible from linux machines, so Solaris machines continue to run the original nedit program, whereas linux computers now run gedit where nedit is required.
Similar tricks can be applied to other programs like, dtterm (gnome-terminal), dtpad (gedit), sdtimage (eog) etc. Names in the parenthesis indicate alternative linux applications to be linked.
Update Snapshot
Detecting architecture
In many occasions, you may want to change the behavior of your script depending on the computer architecture. Here are ways to detect in which architecture the script is running.
Bash
if [ $OSTYPE = solaris ] then echo "doing something for solaris" else echo "doing something for linux" fi
csh
if ($OSTYPE == 'solaris') then echo "doing something for solaris" else echo "doing something for linux" endif
