How to run something in background in CentosSetting default desktop in CentOS 6.2Setting up FQDN in CentOS...
How much do grades matter for a future academia position?
Do I have to take mana from my deck or hand when tapping a dual land?
Should I assume I have passed probation?
How to test the sharpness of a knife?
Does the Crossbow Expert feat's extra crossbow attack work with the reaction attack from a Hunter ranger's Giant Killer feature?
Why do Radio Buttons not fill the entire outer circle?
Overlapping circles covering polygon
Origin of pigs as a species
Giving feedback to someone without sounding prejudiced
El Dorado Word Puzzle II: Videogame Edition
How many people need to be born every 8 years to sustain population?
Sigmoid with a slope but no asymptotes?
Is there anyway, I can have two passwords for my wi-fi
What is this high flying aircraft over Pennsylvania?
Why the various definitions of the thin space ,?
Identifying "long and narrow" polygons in with PostGIS
Quoting Keynes in a lecture
Language involving irrational number is not a CFL
Why the "ls" command is showing the permissions of files in a FAT32 partition?
How to preserve electronics (computers, iPads and phones) for hundreds of years
Ways of geometrical multiplication
Proving an identity involving cross products and coplanar vectors
Storage of electrolytic capacitors - how long?
Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?
How to run something in background in Centos
Setting default desktop in CentOS 6.2Setting up FQDN in CentOS 6.3can't run lspci in centos 6?VNC Server on Centos 6how to edit initrd.img to add a autostart application at boot in a live CentOS imageCan I run Centos 6 on my old xp computer?How do I execute/run a .sql file in PostgreSQL 9.2.6 + CentOsHow to adjust brightness level in Centos 6.6CentOS release 6.9 (Final) appends twiceDownloading CentOS 7.2 64-bit (or CentOS 6.8, 64 bit)?
I use CentOS and I have a little bit of difficulty with background tasks
When something like updatedb command is running, I press CTRL+Z, instead of running in the background it immediately says
[1]+ Stopped updatedb
Which I assume means the task has stopped, well this upsets me a little bit I thought CTRL+Z sends the task to background not stop it.
Then I use the bg command and it returns
[1]+ updatedb &
And then it seems like the task is continuing in the background, but the problem is if the task has some standard output it will be shown on the display! Making the command shell almost useless.
I know I can redirect the standard output to a file or dev null or something but why all this pain to do a simple task? What's a better way of doing the same?
I mean not adding & at the end of the command but just sending the current process to the background and having it not be annoying in CentOS?
centos-6
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I use CentOS and I have a little bit of difficulty with background tasks
When something like updatedb command is running, I press CTRL+Z, instead of running in the background it immediately says
[1]+ Stopped updatedb
Which I assume means the task has stopped, well this upsets me a little bit I thought CTRL+Z sends the task to background not stop it.
Then I use the bg command and it returns
[1]+ updatedb &
And then it seems like the task is continuing in the background, but the problem is if the task has some standard output it will be shown on the display! Making the command shell almost useless.
I know I can redirect the standard output to a file or dev null or something but why all this pain to do a simple task? What's a better way of doing the same?
I mean not adding & at the end of the command but just sending the current process to the background and having it not be annoying in CentOS?
centos-6
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
Yeah, it isn't that hard to doupdatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add& disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")
– nerdwaller
Jun 27 '13 at 22:53
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
1
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56
add a comment |
I use CentOS and I have a little bit of difficulty with background tasks
When something like updatedb command is running, I press CTRL+Z, instead of running in the background it immediately says
[1]+ Stopped updatedb
Which I assume means the task has stopped, well this upsets me a little bit I thought CTRL+Z sends the task to background not stop it.
Then I use the bg command and it returns
[1]+ updatedb &
And then it seems like the task is continuing in the background, but the problem is if the task has some standard output it will be shown on the display! Making the command shell almost useless.
I know I can redirect the standard output to a file or dev null or something but why all this pain to do a simple task? What's a better way of doing the same?
I mean not adding & at the end of the command but just sending the current process to the background and having it not be annoying in CentOS?
centos-6
I use CentOS and I have a little bit of difficulty with background tasks
When something like updatedb command is running, I press CTRL+Z, instead of running in the background it immediately says
[1]+ Stopped updatedb
Which I assume means the task has stopped, well this upsets me a little bit I thought CTRL+Z sends the task to background not stop it.
Then I use the bg command and it returns
[1]+ updatedb &
And then it seems like the task is continuing in the background, but the problem is if the task has some standard output it will be shown on the display! Making the command shell almost useless.
I know I can redirect the standard output to a file or dev null or something but why all this pain to do a simple task? What's a better way of doing the same?
I mean not adding & at the end of the command but just sending the current process to the background and having it not be annoying in CentOS?
centos-6
centos-6
edited Sep 28 '14 at 18:31
ᔕᖺᘎᕊ
5,24842441
5,24842441
asked Jun 27 '13 at 22:44
user893730user893730
59221324
59221324
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
Yeah, it isn't that hard to doupdatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add& disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")
– nerdwaller
Jun 27 '13 at 22:53
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
1
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56
add a comment |
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
Yeah, it isn't that hard to doupdatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add& disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")
– nerdwaller
Jun 27 '13 at 22:53
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
1
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
Yeah, it isn't that hard to do
updatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add & disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")– nerdwaller
Jun 27 '13 at 22:53
Yeah, it isn't that hard to do
updatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add & disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")– nerdwaller
Jun 27 '13 at 22:53
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
1
1
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56
add a comment |
1 Answer
1
active
oldest
votes
You can use screen or tmux. They will allow you to work with virtual terminals.
So you can start updatedb in a terminal an continue to work in another virtual terminal.
http://tmux.sourceforge.net/
http://www.gnu.org/software/screen/
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f612972%2fhow-to-run-something-in-background-in-centos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use screen or tmux. They will allow you to work with virtual terminals.
So you can start updatedb in a terminal an continue to work in another virtual terminal.
http://tmux.sourceforge.net/
http://www.gnu.org/software/screen/
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
add a comment |
You can use screen or tmux. They will allow you to work with virtual terminals.
So you can start updatedb in a terminal an continue to work in another virtual terminal.
http://tmux.sourceforge.net/
http://www.gnu.org/software/screen/
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
add a comment |
You can use screen or tmux. They will allow you to work with virtual terminals.
So you can start updatedb in a terminal an continue to work in another virtual terminal.
http://tmux.sourceforge.net/
http://www.gnu.org/software/screen/
You can use screen or tmux. They will allow you to work with virtual terminals.
So you can start updatedb in a terminal an continue to work in another virtual terminal.
http://tmux.sourceforge.net/
http://www.gnu.org/software/screen/
answered Jun 28 '13 at 0:23
Just1602Just1602
1616
1616
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
add a comment |
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
Will screen stop working if your ssh session is disconnected?
– user893730
Jun 28 '13 at 0:33
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
In screen you can "detach" a terminal. If you terminal is detach you'll be able to close you ssh session, come back later and get every screen terminals you had detach in your previous ssh session. Here is a screen tutorial
– Just1602
Jun 28 '13 at 0:40
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
and screen detaches by default when ssh loses connection, for clarity.
– Sirex
Jun 30 '13 at 3:21
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
I'm not sure, but I think you have to detach your screen before closing your ssh connection.
– Just1602
Jul 1 '13 at 22:57
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f612972%2fhow-to-run-something-in-background-in-centos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
not really sure what you're asking. redirecting to a file removes the output, and it's hardly much hassle ?
– Sirex
Jun 27 '13 at 22:46
Yeah, it isn't that hard to do
updatedb &> /dev/null
. Or just have a shell tab with that if you'd rather just hit Shift+Ctrl+T. Or add& disown
after the /dev/null so your background process doesn't get killed with the shell. Or make an alias for the command to save you the typing. (I.e. alias updb="updatedb &> /dev/null & disown")– nerdwaller
Jun 27 '13 at 22:53
Sirex, here is why it's a hassle, you already are running a script for two hours, you press CTRL+Z, you don't want it to run from the beginning, and it makes shell impossible to use. So you have to terminate the process, and rerun it with output redirects, wait another 2 hours to get where you were before, make sense?
– user893730
Jun 27 '13 at 22:55
1
@user893730 - That doesn't make sense, because now you are aware of the issue and can type the command before you get 2hrs in and have that headache...
– nerdwaller
Jun 27 '13 at 22:56
Another reason it's annoying is that sometimes you can't simply redirect the output, because some commands wait for your input after you run them, so now you have to create an input file, redirect both input and output, and basically create two files to do a simple thing.
– user893730
Jun 27 '13 at 22:56