- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help needed
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
02-06-2003 10:39 AM
02-06-2003 10:39 AM
I am running the following script from cron:
set -x
host=`hostname`
if [ $host = "db05461" -o $host = "dbumegan" ]
then
tapeid=`/usr/sbin/mc -r DS | grep DT_slot_1 | awk '{print $3}'`
fi
echo $tapeid
Here is the data that the script is looking at:
#mc -r DS
DT_slot_1 FULL W2T004
DT_slot_2 EMPTY
ST_slot_1 FULL W2T001
ST_slot_2 FULL W2T002
ST_slot_3 FULL W2T003
ST_slot_4 FULL W2T004
ST_slot_5 FULL W2T005
ST_slot_6 FULL W2T001
ST_slot_7 FULL W2T002
ST_slot_8 FULL W2T003
ST_slot_9 EMPTY
ST_slot_10 FULL W2T005
ST_slot_11 FULL W2T001
ST_slot_12 FULL W2T002
ST_slot_13 FULL W2T003
ST_slot_14 FULL W2T004
ST_slot_15 FULL W2T005
ST_slot_16 EMPTY
ST_slot_17 EMPTY
ST_slot_18 EMPTY
ST_slot_19 EMPTY
Now here is the problem. If I run the script manually from a prompt, it works correctly and tapeid gets the correct value (W2T004).
+ + hostname
host=db05461
+ [ db05461 = db05461 -o db05461 = dbumegan ]
+ + /usr/sbin/mc -r DS
+ awk {print $3}
+ grep DT_slot_1
tapeid=W2T004
+ echo W2T004
W2T004
When I run from cron, the script gives me the following error in the log file (tapeid gets no value):
+ + hostname
host=db05461
+ [ db05461 = db05461 -o db05461 = dbumegan ]
+ + grep DT_slot_1
+ awk {print $3}
+ /usr/sbin/mc -r DS
ERROR: No such file or directory
tapeid=
+ echo
I am completely stumped. What is going wrong?
Thanks,
Craig
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 10:44 AM
02-06-2003 10:44 AM
Re: Script help needed
'mc' command must require something set inside either the PATH or environment variables, which 'cron' will not do by default.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 10:44 AM
02-06-2003 10:44 AM
Re: Script help needed
It's probably because the PATH variable is not set in the cronjob
-USA..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 10:52 AM
02-06-2003 10:52 AM
Re: Script help needed
and try running in cron again.
cron didn't use profile and hence may not have all the paths available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 10:58 AM
02-06-2003 10:58 AM
Re: Script help needed
export PATH=`cat /etc/PATH`
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 11:01 AM
02-06-2003 11:01 AM
Re: Script help needed
mean instead of grep do /usr/bin/grep and for awk /usr/bin/awk
if you do not know the run path for a command use the whereis command
example
whereis awk
awk: /sbin/awk /usr/bin/awk /usr/share/man/man1.Z/awk.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 11:07 AM
02-06-2003 11:07 AM
Re: Script help needed
Pursuing the no such file or directory angle, this seems to be coming from the mc command, and the only file mc uses is /dev/scsi/3.
Try adding /dev/scsi into your PATH.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 11:38 AM
02-06-2003 11:38 AM
Re: Script help needed
The fix was the -p switch in the mc command.
Thanks to all for your excellent replies.
Craig