- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: error_in script
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
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
тАО01-04-2010 01:27 AM
тАО01-04-2010 01:27 AM
While executing this script
#################
echo "getting the events dump"
Date=$(date)
/opt/OV/bin/ovdumpevents > events
echo "now processing events"
more events |grep OVpatternDelete >list
Value=$(tail -1 list|awk '{print $8}')
EvDate=$(tail -1 list|awk '{print $3, $4, $5, $6, $7}'|cut -c -8,10-)
if [ ${Value} = "OVpatternDelete" && ${Date} = ${EvDate} ]
then
echo "processing mail"
else
echo "no action"
fi
i am getting the following error.
# sh ecschk.sh
getting the events dump
now processing events
ecschk.sh[10]: test: A ] character is missing.
no action
please help me to solve this.
Thanks & Regards
Solved! Go to Solution.
- Tags:
- Test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 01:49 AM
тАО01-04-2010 01:49 AM
Re: error_in script
replace
if [ ${Value} = "OVpatternDelete" && ${Date} = ${EvDate} ]
by
if [ ${Value} = "OVpatternDelete" -a ${Date} = ${EvDate} ]
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 02:05 AM
тАО01-04-2010 02:05 AM
Re: error_in script
Thanks for the correction.
i replaced the as per your suggestion.
now am getting this error
sh ecschk.sh
getting the events dump
now processing events
ecschk.sh[10]: Jan: A test command parameter is not valid.
no action
Also please tell me the diff in && and -a.i dont have any experience in this.i just simply followed some sytax from google.
THANKS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 02:52 AM
тАО01-04-2010 02:52 AM
Solutionif [ "${Value}" = "OVpatternDelete" -a "${Date}" = "${EvDate}" ]
The && syntax for "and" doesn't work in a test statement in the HP-UX POSIX shell - the code you got from google was probably for another shell which supports both syntaxes...
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 10:14 AM - edited тАО08-27-2011 04:30 AM
тАО01-04-2010 10:14 AM - edited тАО08-27-2011 04:30 AM
Re: error in script
>Duncan: The && syntax for "and" doesn't work in a test statement in the HP-UX POSIX shell
If you want to use &&, you need to use [[ ]]:
if [[ "${Value}" = "OVpatternDelete" && "${Date}" = "${EvDate}" ]]; then
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 11:34 PM
тАО01-04-2010 11:34 PM
Re: error_in script
Thanks a lot for the information.
now i am facing another error while executing. This command will be executed by the application (as user bin ).i tried a lot with changing permission and all . please have a look into this
Tue Jan 05 12:57:38 Command "/usr/sbin/evdel.sh" returned standard error data:
/usr/sbin/evdel.sh[5]: /tmp/ActionNNM/events: Cannot create the specified file.
/tmp/ActionNNM/events: No such file or directory
list: No such file or directory
rm: events non-existent
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 11:48 PM - edited тАО08-27-2011 04:30 AM
тАО01-04-2010 11:48 PM - edited тАО08-27-2011 04:30 AM
Re: error in script
>This command will be executed by the application (as user bin).
Typically bin isn't a real user. How are you logged into bin?)
>"/usr/sbin/evdel.sh" returned standard error data:
/usr/sbin/evdel.sh[5]: /tmp/ActionNNM/events: Cannot create the specified file.
Does the directory /tmp/ActionNNM exist? If not, you can always use "mkdir -p /tmp/ActionNNM" to make sure.
Does that directory have the right permission?
ll -d /tmp/ActionNNM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 11:52 PM
тАО01-04-2010 11:52 PM
Re: error_in script
Thanks for the quick response.
I didn't logged in as user bin.But when my application executes command as bin.
ll /tmp/ActionNNM/
total 112
-rw-r--r-- 1 bin bin 19140 Jan 5 13:19 action.log
-rw-r--r-- 1 bin bin 2580 Jan 5 13:19 action1.log
drwxr-xr-x 2 root sys 8192 Jan 5 12:44 back
-rwxr-xr-x 1 bin bin 655 Jan 5 12:51 evdel.sh
-rw-r--r-- 1 bin bin 382 Jan 5 12:54 list
Please check the permissions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 11:53 PM
тАО01-04-2010 11:53 PM
Re: error_in script
drwxr-xr-x 3 root sys 8192 Jan 5 12:54 /tmp/ActionNNM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 02:41 AM - edited тАО08-27-2011 04:31 AM
тАО01-05-2010 02:41 AM - edited тАО08-27-2011 04:31 AM
Re: error in script
>But when my application executes command as bin.
That's pretty strange. It would make more sense to create a special user and not use one of the system UIDs.
>drwxr-xr-x 3 root sys 8192 Jan 5 12:54 /tmp/ActionNNM
This does not allow user bin to create the file events. root must create the file and chown it to bin:bin, then bin can write to it.
Or maybe you should have bin own the directory?