- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripts run interactively , not under cron !!!
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
Forums
Discussions
Discussions
Discussions
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
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
10-02-2000 05:12 AM
10-02-2000 05:12 AM
Scripts run interactively , not under cron !!!
I have written a c shell script when run interactively works fine, when I submit it to run under cron, it says
sqlplus: Command not found.
I included in the script the line from the PATH pointing to where the sqlplus program is and I still get the same result.
Any advice?.
Thanking you in advance.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:20 AM
10-02-2000 05:20 AM
Re: Scripts run interactively , not under cron !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:20 AM
10-02-2000 05:20 AM
Re: Scripts run interactively , not under cron !!!
Have you reset all your env variables in your script? since cron doesnt read your .profile/.kshrc...
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:25 AM
10-02-2000 05:25 AM
Re: Scripts run interactively , not under cron !!!
You can source your profile ahead of calling your script. This can/should be done in the crontab entry. Alternatively, you could source your profile within the script itself to provide the necessary environmental variables you need. Thirdly, you could create a new file which contains and exports the common variables needed for your application, and source (read) that within your standard profile, within standard scripts; and/or in a crontab stream.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:26 AM
10-02-2000 05:26 AM
Re: Scripts run interactively , not under cron !!!
Your script will have to set up thing like PATH and other variables that are normally setup by /etc/profile and your .profile or C shell equivalent.
As you are trying to run sqlplus, you will also have to setup the required ORACLE environment - ORACLE_HOME, ORACLE_SID, PATH and SHLIB_PATH (if Oracle 8) as well.
Oracle provide scripts for this like 'oraenv' which are normally placed in /usr/local/bin. In batch mode, they require that ORACLE_SID has already been exported.
Find out where the Oracle scripts have been installed and have a look at them. You can then call them as sub-scripts (. oraenv) from your cron'd script. Be aware that they are written for the Korn/Posix shell though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:36 AM
10-02-2000 05:36 AM
Re: Scripts run interactively , not under cron !!!
You can source your profile ahead of calling your script. This can/should be done in the crontab entry. Alternatively, you could source your profile within the script itself to provide the necessary environmental variables you need. Thirdly, you could create a new file which contains and exports the common variables needed for your application, and source (read) that within your standard profile, within standard scripts; and/or in a crontab stream.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:43 AM
10-02-2000 05:43 AM
Re: Scripts run interactively , not under cron !!!
Looking forward to hearing from you once again.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 05:47 AM
10-02-2000 05:47 AM
Re: Scripts run interactively , not under cron !!!
To source (read) a file within a script, put a dot (".") in front of the script name. For instance, to source a file called /myscript you would do:
. /myscript #...note the space between the dot and the script name.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 06:01 AM
10-02-2000 06:01 AM
Re: Scripts run interactively , not under cron !!!
If you still have problems , post your script and we will go from there .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 07:28 AM
10-02-2000 07:28 AM
Re: Scripts run interactively , not under cron !!!
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 07:38 AM
10-02-2000 07:38 AM
Re: Scripts run interactively , not under cron !!!
Looking at your attachement, I would not expect it to work. Your script is a C-shell but you have sourced a Posix shell profile (i.e. the . .profile).
Try the following to debug your script:
# csh -n /
The -n option parses but does not execute commands. You can check syntax this way.
The -v option causes commands to be echoed to stdout after substitutions are made.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 07:42 AM
10-02-2000 07:42 AM
Re: Scripts run interactively , not under cron !!!
BTW, while everyone has their preference, and while everyone is entitled, you will find that most people avoid the csh shell and/or aren't familar with its syntax. The POSIX shell (/usr/bin/sh) is the standard shell in HP-UX and provides the most solid foundation for scripting.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 07:59 AM
10-02-2000 07:59 AM
Re: Scripts run interactively , not under cron !!!
New to HP-UX and this forum - From an AIX background but think this will help:
Try specifying the shell in the first line of the script. eg:
#!/usr/bin/csh
Certainly in AIX, Sun and Linux cron runs jobs by default with the Bourne shell so any other you need to specify. I would guess that your login session is a c shell hence in runs interactivly.
Hope it helps.
Paul.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 08:07 AM
10-02-2000 08:07 AM
Re: Scripts run interactively , not under cron !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 08:38 AM
10-02-2000 08:38 AM
Re: Scripts run interactively , not under cron !!!
1. Your crontab editing
# crontab -e
1 1 * * * su - ora8 -c "/Path/./yourscript"
2. Try specifying the shell in the first
line of the your script.
#!/usr/bin/csh or #!/bin/csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 08:43 AM
10-02-2000 08:43 AM
Re: Scripts run interactively , not under cron !!!
replace ". .profile" with ". /home/
step2) make plans to replace all csh scripts with either perl or ksh/sh scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2000 10:23 AM
10-02-2000 10:23 AM
Re: Scripts run interactively , not under cron !!!
I might be wrong but I think you need to "source filename" in c shell as against . ./filename.