- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell scripts fails on Autosys but works when run ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 04:38 AM
тАО07-21-2004 04:38 AM
I have a shell script that runs every day from Autosys as user auto_user
The script is like this:
###############################
export FILE_DIR=${TOP}/bin
PWD=`<${FILE_DIR}/pwd.txt`
#################################
$TOP is set in the .profile of the auto_user
and autouser has wrx on pwd.txt
What is happending is that when the script runs from Autosys it tries to look for the pwd.txt file from /bin/pwd.txt
Here is the Autosys log:
/home/bin/run_ftp.ksh[24]: /bin/ncadmin_pwd.txt: cannot open
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 04:43 AM
тАО07-21-2004 04:43 AM
Re: Shell scripts fails on Autosys but works when run manually
If I remember autosys functions correctly, it does NOT actually log in as a user, thus it doesn't get anything that is set within the .profile.
Best practice with any scripts that are run via a scheduler is to either 1) set the value of all variables within the script, or 2) have all variables in another file and source that file from within the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 04:44 AM
тАО07-21-2004 04:44 AM
Re: Shell scripts fails on Autosys but works when run manually
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 04:48 AM
тАО07-21-2004 04:48 AM
Re: Shell scripts fails on Autosys but works when run manually
Why not just /full_path_of_pwd.txt??
Also typo in your code
export FILE_DIR=${TOP}/bin
PWD=`<${FILE_DIR}/pwd.txt`
< should not be there.
or
PWD='${TOP}/bin/pwd.txt'
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 04:52 AM
тАО07-21-2004 04:52 AM
Re: Shell scripts fails on Autosys but works when run manually
Within your script, echo $TOP should give you what you have specified in .profile of the user.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 05:04 AM
тАО07-21-2004 05:04 AM
Re: Shell scripts fails on Autosys but works when run manually
But if I hardcode the path in the program further down the script fails to get the sqlplus uitility. I think its because $ORACLE_HOME is also not set for the autouser.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 05:35 AM
тАО07-21-2004 05:35 AM
Re: Shell scripts fails on Autosys but works when run manually
I tried to exeute the .profile in my script by putting:. /home/autouser/.profile
It gives this error in the log file
Not a terminal
^M^[[3g^M ^[H ^[H ^[H ^[H ^[H ^[H
^[H ^[H ^[H^MNot a terminal
^M^[[3g^M ^[H ^[H ^[H ^[H ^[H ^[H
^[H ^[H ^[H^M/data/bin/pwd.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 05:43 AM
тАО07-21-2004 05:43 AM
Re: Shell scripts fails on Autosys but works when run manually
if [[ -t 0 ]]
then
eval ` tset -s -Q `
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
stty susp ""
stty dsusp ""
tabs
fi
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 05:50 AM
тАО07-21-2004 05:50 AM
Re: Shell scripts fails on Autosys but works when run manually
I wanted to ask you one more question:
The script runs as follows by the autosys
1. user "auto" is the actual autosys user
2. user "auto" logs in as "auto_user" and then exeucte the shell script.
3. auto_user owns the shell script
If I modify the .profile of auto_user and try to execute the .profile file in the beginning of the program will it work?
I don't have access to autosys so i am asking you this question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 06:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-21-2004 07:09 AM
тАО07-21-2004 07:09 AM
Re: Shell scripts fails on Autosys but works when run manually
the profile attribute specifies the file to be sourced by the shell before the specified command is execture. The autosys remote agent always spawns a process and starts the shell in that process, passing it the name of the profile to be sources. this profile typically includes definintons and exports of environment variables, which can be referenced in the job's command. the primary environmnet variable in the profile is the $PATH. if a profile is not specified, the default autosys profile, /etc/auto.profile, is used. if the profile attribute is specified, that profile is searched for on the machine on which the command is to run.
if a command that normally executes when entered at the command line fails when run as an autosys job, it is usually due to the incomplete specification of the required environment for the command in the autosys profile file.