Im trying to write a /bin/bash script that refreshes VMware Fusion using the built in snapshot capabilities.
I am having an issue getting a variable to pass into the find argument of an "if-then" statement.
Im thinking the problem might have something to do with the working directory of the script, not being able to find the file within its location.
Like I said, I think the problem has something to do with this part:
just passing that part reveals the item I need, but not the path to the item.
However if I add the path in front of the variable, then I just get the path.
I've tried changing the directory to the source of the file, but honestly I've never used a "cd" command in a script, so im not even sure if you can do that.
If any body had any ideas, it would be much appreciated.
Sure you could 'cd ..' any time in script.
The 'grep -m2 ...' - I do not know this option
If your system has this option, be sure $vmopen is not empty (compare to "", or with -z in 'if ..'
Is that is your question?
Also, you are right, to check a file for existance you need or to be in that directory, or to check with path. You already have it (I do not know why you do not use already defined variables)
Last edited by alex_5161; 11-05-2008 at 11:35 PM..
when VMware Fusion is running a OS, there is a file called "Ubuntu-000001.vmdk.lck"
the problem is, is that this file changes names, otherwise I would just reference the file.
When vm is running the contents of the Ubuntu.vmwarevm/ is:
-rw-rw-rw-@ 1 xxxxxx staff 7405568 Nov 5 22:34 Ubuntu-000001.vmdk
drwxrwxrwx 3 xxxxxx staff 102 Nov 5 22:32 Ubuntu-000001.vmdk.lck
-rw-rw-rw-@ 1 xxxxxx staff 536870912 Nov 5 20:30 Ubuntu-Snapshot2.vmem
-rw-rw-rw-@ 1 xxxxxx staff 68563738 Nov 5 20:30 Ubuntu-Snapshot2.vmsn
-rw-rw-rw-@ 1 xxxxxx staff 8684 Nov 5 22:32 Ubuntu.nvram
-rwxrwxrwx@ 1 xxxxxx staff 3941924864 Nov 5 20:30 Ubuntu.vmdk
drwxrwxrwx 3 xxxxxx staff 102 Nov 5 22:32 Ubuntu.vmdk.lck
-rw-rw-rw-@ 1 xxxxxx staff 536870912 Nov 5 21:33 Ubuntu.vmem
drwxrwxrwx 3 xxxxxx staff 102 Nov 5 22:32 Ubuntu.vmem.lck
-rwxrwxrwx@ 1 xxxxxx staff 800 Nov 5 20:30 Ubuntu.vmsd
-rw-rw-rw-@ 1 xxxxxx staff 66693236 Nov 5 22:32 Ubuntu.vmss
-rwxrwxrwx@ 1 xxxxxx staff 2533 Nov 5 22:32 Ubuntu.vmx
drwxrwxrwx 3 xxxxxx staff 102 Nov 5 22:32 Ubuntu.vmx.lck
-rw-rw-rw-@ 1 xxxxxx staff 16634 Nov 5 21:24 Ubuntu.vmxf
-rw-r--r-- 1 xxxxxx staff 5221 Nov 5 22:32 quicklook-cache.png
-rw-r--r-- 1 xxxxxx staff 77570 Nov 5 21:51 vmware-0.log
-rw-r--r-- 1 xxxxxx staff 76195 Nov 5 21:24 vmware-1.log
-rw-r--r-- 1 xxxxxx staff 77060 Nov 5 21:16 vmware-2.log
-rw-r--r-- 1 xxxxxx staff 74671 Nov 5 22:32 vmware.log
When it isnt running its:
-rw-rw-rw-@ 1 xxxxxx staff 7405568 Nov 5 22:34 Ubuntu-000001.vmdk
-rw-rw-rw-@ 1 xxxxxx staff 536870912 Nov 5 20:30 Ubuntu-Snapshot2.vmem
-rw-rw-rw-@ 1 xxxxxx staff 68563738 Nov 5 20:30 Ubuntu-Snapshot2.vmsn
-rw-rw-rw-@ 1 xxxxxx staff 8684 Nov 5 22:34 Ubuntu.nvram
-rwxrwxrwx@ 1 xxxxxx staff 3941924864 Nov 5 20:30 Ubuntu.vmdk
-rw-rw-rw-@ 1 xxxxxx staff 536870912 Nov 5 21:33 Ubuntu.vmem
-rwxrwxrwx@ 1 xxxxxx staff 800 Nov 5 20:30 Ubuntu.vmsd
-rw-rw-rw-@ 1 xxxxxx staff 66693236 Nov 5 22:34 Ubuntu.vmss
-rwxrwxrwx@ 1 xxxxxx staff 2544 Nov 5 22:34 Ubuntu.vmx
-rw-rw-rw-@ 1 xxxxxx staff 16634 Nov 5 21:24 Ubuntu.vmxf
-rw-r--r-- 1 xxxxxx staff 0 Nov 5 22:34 quicklook-cache.png
-rw-r--r-- 1 xxxxxx staff 77570 Nov 5 21:51 vmware-0.log
-rw-r--r-- 1 xxxxxx staff 76195 Nov 5 21:24 vmware-1.log
-rw-r--r-- 1 xxxxxx staff 77060 Nov 5 21:16 vmware-2.log
-rw-r--r-- 1 xxxxxx staff 77214 Nov 5 22:34 vmware.log
so, check the $vmopen before use it:
Also, the "Ubuntu-000001.vmdk.lck" (that you attempt to grep from 'ls ..') is a directory, not a file.
So:
Existance could be checked by (in ksh or in bash) by -e option or by combining -f .. || -d .. (so, is file or directory)
Last edited by alex_5161; 11-06-2008 at 12:02 AM..
Hi 2 all,
i have had AIX 7.2
:/# /usr/IBMAHS/bin/apachectl -v
Server version: Apache/2.4.12 (Unix)
Server built: May 25 2015 04:58:27
:/#:/# /usr/IBMAHS/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
... (3 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Hi,
Can anyone please advise a universal command option for using sar to check for paging/memory issues.
For Linux, I used sar -B and check on the majflt/s column and a high number is supposed to indicate paging issues, is that correct?
Unfortunately, on a Solaris server, sar -B does not... (1 Reply)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Let me preface with I am semi-new to Solaris. I work with it in the labs at work and that's about my extent (although I run Linux at home).
Well, a week ago security comes around with updated requirements, some of which are the need to audit all failures. For the life of me I cannot get a... (0 Replies)
been a while so i'm a bit rusty and need a little help. writing a script that needs to compare $EXECHOST(a number) against a numerical range and then set a value. below isn't working but should give you folks an idea of my goal:
if ; then
echo "This is a 32B machine, exiting..."
if ;... (4 Replies)
To speed up our backups, I found a way to compress all the backups files without running out of space. But before starting to use this in our procedures, I want to know if the command 'compress' has any issues in AIX 4.2 with files bigger then 1Gig. Our backup files have sizes ranging between 600Mg... (1 Reply)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)