Conditional checking for VMWARE command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Conditional checking for VMWARE command
# 1  
Old 05-21-2009
Conditional checking for VMWARE command

Hello,

I have to runt he following VMWARE script to take a snap shot of my machine:

vmware-cmd -v /vmfs/volumes/44e9c20f-71ded630-3ac2-00137221e12a/orion/orion.vmx createsnapshot Weekly_Backup

I need to check if successfully executes or not so I thought I would put it in a IF STATEMENT

if [ vmware-cmd -v /vmfs/volumes/44e9c20f-71ded630-3ac2-00137221e12a/orion/orion.vmx createsnapshot Weekly_Backup ]
then
echo "Success"
else
echo "Failure"
fi
I get a too many argument error message and it echoes failure although I know the command works. Something is wrong with the if then statement can someone help please?
# 2  
Old 05-25-2009
Get rid of the left and right brackets, and it should work.
# 3  
Old 05-25-2009
Alternately:
Code:
V="/vmfs/volumes/44e9c20f-71ded630-3ac2-00137221e12a/orion/orion.vmx"
vmware-cmd -v $V createsnapshot Weekly_Backup  &&  echo Success  ||  echo Failed

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help understanding what this ls -l command is checking in a script

Hello, we have a script that has the two following lines: ssh -qno StrictHostKeyChecking=no -o ConnectTimeout=1 user@IP 'ls -l /home/opsmgrsvc >/dev/null 2>&1' > /dev/null 2>&1 status="$(echo $?)" I can't understand what these two lines are doing? When I execute the first line nothing... (6 Replies)
Discussion started by: greavette
6 Replies

2. UNIX for Dummies Questions & Answers

Bashrc File - Conditional Command Execution?

Hello All, I was wondering if there is a way to execute a command in my ".bashrc" file based on how I logged into the PC? I was thinking maybe there is a way to check how the user (*myself) logged in, maybe somehow with the who command along with something else, but I'm not sure... I know I... (7 Replies)
Discussion started by: mrm5102
7 Replies

3. Shell Programming and Scripting

Checking if command ran in parallel

Hi, I am running below code For I in $var do .......some line of code....... nohup Sqlplus apps/apps <<EOF & My_proc($I) Exit EOF done Nohup and & is used for parallel processing. Can someone help in determining if the procedure with different arguments Was called paralley or... (3 Replies)
Discussion started by: Pratiksha Mehra
3 Replies

4. Programming

Python Conditional Statements Based on Success of Last Command

In shell scripting, I can create a conditional statement based on the success or failure (exit status)of a command such as: pinger() { ping -c 2 $remote_host >/dev/null 2>&1 ping_stat=$? } pinger if ]; then echo "blahblahblah" exit 0 fi how is this done using Python using... (3 Replies)
Discussion started by: metallica1973
3 Replies

5. Shell Programming and Scripting

Checking has for a command line argument

I would like to search and print a match of the user entered $ARGV. Im terrible with hashes and really dont know where to go from here. The example data file name location phone Bugs holeintheground 5551212 Woody holeinthetree 6661313 Jerry holeinthewall 7771414... (4 Replies)
Discussion started by: sumguy
4 Replies

6. Shell Programming and Scripting

Conditional grep command to search entire file

Let me give you a complete example what I am trying to achieve. 1. Below is the log file structure where I need 2,5 and 14th column of the logs after grepping through the linkId=1ddoic. Log file structure:- abc.com 20120829001415 127.0.0.1 app none11111 sas 0 0 N clk Mozilla/5.0... (3 Replies)
Discussion started by: kmajumder
3 Replies

7. UNIX for Advanced & Expert Users

Advance conditional grep command

Hi guys, I need your help to use advance grep command, In my example below, I have 5 container which has some information on it, and I need to grep specific word "PLMNCode=454F00" which will not only grep the line contains that word, but I need to print the output for the whole container. Input... (6 Replies)
Discussion started by: hapalon
6 Replies

8. Shell Programming and Scripting

Conditional mailing as command result

Hi ! I would like to be informed by mail when a ping conmand exceeds a certain avarage value. This is the output of the ping command rtt min/avg/max/mdev = 164.505/165.522/166.540/1.095 ms I need to get the second value (165.522) and if greater than 200, send a mail. This should... (2 Replies)
Discussion started by: gadile
2 Replies

9. Shell Programming and Scripting

checking for command output validity

hi, i'm trying to write a script to check if the home directories of users are set correctly. below is an extract of the script here, i am trying to put the name of the owner of the home directory into the variable dirperm (by reading lines in /etc/passwd). however, it seems that when the... (1 Reply)
Discussion started by: roddo90
1 Replies

10. Shell Programming and Scripting

Looping and conditional branching on the command line

I am piping STDOUT from commands such as ifconfig and dmesg through grep, sed and awk to get the information I need. I need to now perform some looping and branching now and have been trying to figure out how to do this on the command line. You may ask "Why the command line? - Why not put it... (2 Replies)
Discussion started by: karlgo
2 Replies
Login or Register to Ask a Question