LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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


Reply
  Search this Thread
Old 12-26-2010, 09:42 PM   #1
bluethundr
Member
 
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 124

Rep: Reputation: 15
Post custom xen shutdown command fails


I have a custom command I've made to quickly shut down all of my xen instances.

Code:
[root@LCENT02 ~]# virtdown
-bash: syntax error near unexpected token `2'
As you can see it fails when I try to run it on the command line. It is stored in an ~/.env file in my home directory.


What is odd to me is if I open the .env file and copy the command from there and paste it into the command line, it does actually work!

Code:
[root@LCENT02 ~]# for i in `virsh list | grep -v -e Id -e --- -e Domain-0 | awk '{print $1}'`; do virsh shutdown $i; done
Domain 1 is being shutdown

Domain 2 is being shutdown

Domain 3 is being shutdown

And this is how I have the command entered into my .env file:

Code:
alias virtdown="for i in `virsh list | grep -v -e Id -e --- -e Domain-0 | awk '{print $1}'`; do virsh shutdown $i; done"
Why would this command work if you paste it onto the command line but not use the custom command virtdown?
"

Thanks in advance!!
 
Old 12-28-2010, 07:31 AM   #2
wisnoskij
LQ Newbie
 
Registered: May 2010
Posts: 9

Rep: Reputation: 0
I am quite a Linux newbie but I have a few comments/suggestions.

You could of course just create a script file and put the command in it, that would almpost certainly solve your problem.

But if you are set on using a single alias file I would hazard a guess that the quotes ("") are causing your trouble. I do not use alias much but I wonder if it accepts ('') or possibly even (``) instead of the quotes.

Try this (the ('') already in the code has been changed to ("")):
Code:
alias virtdown='for i in `virsh list | grep -v -e Id -e --- -e Domain-0 | awk "{print $1}"`; do virsh shutdown $i; done'
It tries to run for me, but I do not have all the needed packages installed.

Last edited by wisnoskij; 12-28-2010 at 08:02 AM. Reason: formatting
 
  


Reply

Tags
bash, xen


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
'shutdown' command causing unclean shutdown silentwol Linux - Software 3 07-01-2009 03:01 AM
custom kernel xen-linux-system-2.6.26-1-xen-amd64 vasco2009 Linux - Software 0 03-30-2009 03:54 PM
Xen Fails to Boot worldgnat Linux - Kernel 2 07-15-2007 12:21 AM
'shutdown now' successful, 'shutdown -r now' fails Stomatella Linux - Hardware 4 05-23-2006 11:45 PM
LXer: Installing Xen 3.0 upon Debian Unstable, with a custom Kernel LXer Syndicated Linux News 0 01-03-2006 12:31 PM


All times are GMT -5. The time now is 12:35 AM.

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