LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-22-2017, 01:44 PM   #1
end
Member
 
Registered: Aug 2016
Posts: 266

Rep: Reputation: Disabled
script linux


hy

i have this in script

Code:
#!/bin/bash
qemu-system-x86_64  -display none -vnc :1 -m 1G -smp 2   -enable-kvm -boot order=d  ~/vm/w7.img   
-cpu host   -usbdevice tablet   &&  vncviewer :1
i whant that vncdisplay open after qemu command. qemu command run i foreground so i need send it to bg and execute vnc.

i run script ./script & disown and then vnc display but howe make this in script so i dont need write ./script & disown just ./script
 
Old 03-22-2017, 01:52 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
If Qemu runs as it should then you can try connecting the two with & instead of &&. The latter actually waits for the the first program to finish and then reacts based on the exit code. The former puts the first program into the background and then proceeds to run the second program.

Code:
sleep 5 && echo Hello

sleep 5 & echo Hello
See the bash manual down in the section on "Lists" for info on &&
 
1 members found this post helpful.
Old 03-22-2017, 01:59 PM   #3
end
Member
 
Registered: Aug 2016
Posts: 266

Original Poster
Rep: Reputation: Disabled
re

yes i try with & but qemu still opens in foreground and then vnc whant open until qemu is in fg.

but when i run from terminal with & qemu goes to bg.

Last edited by end; 03-22-2017 at 02:00 PM.
 
Old 03-22-2017, 05:47 PM   #4
end
Member
 
Registered: Aug 2016
Posts: 266

Original Poster
Rep: Reputation: Disabled
sorry, its working. qemu was giving some warnings but process was in bg. beacouse warnings he couldnt execute second command.
 
  


Reply



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



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:07 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
Open Source Consulting | Domain Registration