Friday, October 3, 2008

Sourcing Magazine

http://www.sourcingmag.com/
http://www.outsourcing-weblog.com/

shell, environment, .profile, some notes, su - informix

Issue: your binary cannot work, when you change user (su), you schedule (cron) a script to run, but the executed binary inside the script cannot work properly

Reason:
When you change user and forgot to input the '-' paramter, before the username (su informix) instead of (su - informix). Unix won't run .profile (based in the user's home folder) So environment won't configured correctly, etc. $HOME, some kind of environment variable, some initial scripts, etc. So your binary won't work or announce some issues

The same, when you script the cron job, the script will be run in an another shell each time, and by default that shell won't configured (run .profile) so you script will be failed. To avoid this, at beginning of your script, you need to add some codes like:

#!/bin/ksh
/.profile

Digital Inspiration Technology Guide

Change the world with your passion