LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 08-28-2018, 11:49 AM   #1
Sleepinfire
LQ Newbie
 
Registered: Aug 2018
Posts: 9

Rep: Reputation: Disabled
Question Syntax error


This will probably be an easy one for yall... Let me explain a what I'm trying to accomplish and hopefully I'm going about it the right way.

I am working with VMware vSphere 6.0 and some virtual machines and datastores. I am wanting to do a VM level backup of the servers in the environment. To do this, I have created a Centos 7 VM as my backup server. This VM will SSH into each ESXi host and backup each VM. First it will create a snapshot of the vm, then SCP the files from one datastore to another. Then run stat against the two .vmdk files and indicate a success or failure based off the file size. Then it will remove the snapshot. For logging I have it running under the script command which is being saved on the VM, (I haven't gotten this far-->) and then I'd like it to send an email indicating success or failure

SSH is setup for the secure automated login, I'm brand new at scripting and have been googling my way through this, so if anybody can help educate me here I'd greatly appreciate it. Thanks!

script -q -c "ssh -t 192.168.0.203 vim-cmd vmsvc/snapshot.create 3 Backup$(date); scp -rp /vmfs/volumes/59d7ffef-31c1a41d-9591-9c8e99197ca8/testbk /vmfs/volumes/5b59d89d-a083d558-a0dc-842b2b6b0464/; if stat -c%s /vmfs/volumes/59d7ffef-31c1a41d-9591-9c8e99197ca8/testbk/testbk.vmdk = stat -c%s /vmfs/volumes/5b59d89d-a083d558-a0dc-842b2b6b0464/testbk/testbk.vmdk; then echo "Backup Success!" else echo"Backup Failure!"fi; vim-cmd vmsvc/snapshot.remove 20" > /scp/logs/testbk"$(date).log"
 
Old 08-28-2018, 12:12 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,188
Blog Entries: 13

Rep: Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Please use your other copy of this question, https://www.linuxquestions.org/quest...or-4175637313/
 
1 members found this post helpful.
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] error message in training program, line22: syntax error near unexpected token 'done' Mark_S Linux - Newbie 13 07-21-2015 07:23 PM
dracut gives error on make: modules.d/80cms/cmssetup.sh: line 60: syntax error near abefroman Linux - Software 1 03-04-2013 03:42 PM
script.pl with sed shell calls: sh error syntax error near unexpected token `(' MMaddoxx Programming 7 11-24-2011 09:00 AM
[python] syntax Error : invalid syntax Python_user Programming 2 09-06-2009 01:52 PM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration