- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Run script error
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
03-24-2009 01:15 AM
03-24-2009 01:15 AM
Run script error
the script like below
!/bin/ksh
if [ `date +%d` == 18 ]
then
xx
else
yy
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 01:28 AM
03-24-2009 01:28 AM
Re: Run script error
Could be the path problem.Specify the absolute path for the commands when executing using cron.
/usr/bin/date
Thanks,
Aneesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 01:39 AM
03-24-2009 01:39 AM
Re: Run script error
Are you sure this script works?
I thought the test string comparison operator in sh/ksh was a single "=", not "==" like it is in say C.
You're also missing your # on your shebang.
When specifying the script you should use the absolute path in your crontab.
HTH, Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 02:38 AM
03-24-2009 02:38 AM
Re: Run script error
Since crontab won't inherit the path variables it will fail if absolute paths are not specified in the scripts.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 03:15 AM
03-24-2009 03:15 AM
Re: Run script error
You have to specify full path of date
and moreover from crontab also you have to give the full path
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 08:42 AM
03-24-2009 08:42 AM
Re: Run script error
No, /usr/bin is added to your crontab PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 05:10 PM
03-24-2009 05:10 PM
Re: Run script error
batch
/fullpath/to/your/script
CTRL-D
When you type batch, it gives you a blank line. Type in the name of your script and the return. Then type CTRL-D (the Ctrl key plus the letter d) and the script will run as a batch job. Once it works in batch, it should work OK in cron.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 09:28 PM
03-24-2009 09:28 PM
Re: Run script error
if run in cron that it do not run with /etc/profile & .profile , can advise how can I force the cron job run with it ?
thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 09:53 PM
03-24-2009 09:53 PM
Re: Run script error
You can either change your script or change your crontab entry:
. /etc/profile
. ~/.profile
* * * * * . /etc/profile; ~/.profile; script-name parms ...
You might be able to get away without having /etc/profile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2009 10:26 PM
03-24-2009 10:26 PM
Re: Run script error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2009 01:00 AM
03-25-2009 01:00 AM
Re: Run script error
If you are happy with our answers, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
Oops, I was missing a "." above:
* * * * * . /etc/profile; . ~/.profile; script-name parms ...