- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to find PATH in cron job command?
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
тАО04-06-2003 10:12 PM
тАО04-06-2003 10:12 PM
example, I put the command into /usr/bin/test,
but in cron job, it's only write 'test', and
it's still can execute?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 10:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 10:34 PM
тАО04-06-2003 10:34 PM
Re: How to find PATH in cron job command?
Therefore command lines must include the full path of very single command.
I get around this by either using full patth names or calling scripts(with full path of the script ex /usr/contrib/bin/rec.tape.ksh)
Inside the script I establish a minipath to all of the commands the script uses. It usually takes a few tries to debug the script, but it works.
Set the TERM variable if you are running an application or anything that requires that information.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 10:37 PM
тАО04-06-2003 10:37 PM
Re: How to find PATH in cron job command?
while cron is executing, it wouldn't show the path, it will be executing the command/script in the specified path in the crontab file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 10:48 PM
тАО04-06-2003 10:48 PM
Re: How to find PATH in cron job command?
cron has build in some PATH information:
Try this:
* * * * * echo $PATH >> /tmp/path.txt
and you will find something like this:
/usr/bin:/usr/sbin:.
All other PATH-Information you have ot set explicitly
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 11:06 PM
тАО04-06-2003 11:06 PM
Re: How to find PATH in cron job command?
some commands are built into the shell, e.g. test. It is the built-in command you execute when you write "test" in your cron job. It is of course not necesarily the same command as in /usr/bin/test.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2003 11:19 PM
тАО04-06-2003 11:19 PM
Re: How to find PATH in cron job command?
It is good practise to set the PATH in all scripts you create that will be run from cron.
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2003 12:19 AM
тАО04-07-2003 12:19 AM
Re: How to find PATH in cron job command?
Test is a built-in.
===============================================================
NAME
test - condition evaluation command
SYNOPSIS
test expr
[ expr ]
DESCRIPTION
The test command evaluates the expression expr and, if its value is True, returns a zero (true) exit status; otherwise, a nonzero (false) exit status is returned.
...
===============================================================
K250: usr/bin>more test
#!/usr/bin/sh
# @(#) $Revision: 72.2 $
# This is the execable verison of test utility implemented
# using posix shell built-in test command.
test $@
exit $?
K250: usr/bin>
I would normally set my environment variable in the script itself as others have said above and of course don't forget to the change the script to executable using: chmod +x <scriptName>
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2003 12:36 AM
тАО04-07-2003 12:36 AM
Re: How to find PATH in cron job command?
cron supplies a default environment for every shell, defining:
HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
Users who desire to have their .profile executed must explicitly do so
in the crontab entry or in a script called by the entry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2003 04:10 AM
тАО04-07-2003 04:10 AM
Re: How to find PATH in cron job command?
Bill Hassell, sysadmin