- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script problem
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
05-23-2005 01:46 PM
05-23-2005 01:46 PM
script problem
I need to run some script to kill the ITO agents. However, this script will only run well if I run it manually. Through cron it will run the command never take effect. Anyidea.
#!/usr/bin/sh
/opt/OV/bin/OpC/opcagta -kill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:08 PM
05-23-2005 11:08 PM
Re: script problem
su - root /path/script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:10 PM
05-23-2005 11:10 PM
Re: script problem
This is a classic question. Search for cron, plenty of posts.
The usual problem is that through cron the environment is not set. Therefore, you must set all required variables to run the specific script.
Regards
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:14 PM
05-23-2005 11:14 PM
Re: script problem
Also cron isn't interactive, so if your kill command prompts the user for anything, it will either hang, or throw an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:23 PM
05-23-2005 11:23 PM
Re: script problem
. /opt/OV/bin/ov.envvars.sh
This will setup the environment for OpenView. You'll find that this is either in roots .profile or /etc/profile, which won't get run by your cron job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:24 PM
05-23-2005 11:24 PM
Re: script problem
few things to ensure.
* make sure you have executable permission for the script
* make sure to give full path for the script when you are calling from cron
* just to make sure that cron is actually calling the script, try to echo some test data to a temporary file and see whether it works
eg: echo `date` >> /tmp/test-cron-file
Regards,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:29 PM
05-23-2005 11:29 PM
Re: script problem
You can do this as,
su - -c /opt/OV/bin/OpC/opcagta -kill
It will work. By default for root user, it will ask password. You can use sudo or expert script to do this easily with cron.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 11:30 PM
05-23-2005 11:30 PM
Re: script problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2005 12:16 AM
05-24-2005 12:16 AM
Re: script problem
1. add this line:
. /etc/profile
2. add some logging:
/opt/OV/bin/OpC/opcagta -kill > /tmp/my.log 2>&1
And see if there any error in the log file.
Let us know if it works.
Alex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2005 02:23 AM
05-24-2005 02:23 AM
Re: script problem
There is probably an environment variable missing.
What is the output of the job?
If you don't have that, cron the job like:
/opt/OV/bin/OpC/opcagta -kill 1>/tmp/output 2>&1
Please post the output.
Cheerio,
Renarios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2005 02:47 AM
05-24-2005 02:47 AM
Re: script problem
not sure if it is an error on the script. it should be '/opt/OV/bin/OpC/opcagt -kill' without the 'a' after opcagt.
also, ensure that execute permission is granted for the user executing that script.
scheduling as a cronjob works for me.
regards.