sleep command using command is not displayed in ps
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm running the sleep command in terminal using screen and in detached mode.
Once the screen immediately returns, I'm running ps
command to verify the sleep is running.
$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps
But the command didn't show sleep. What is that I'm doing wrong here?
scripting gnu-screen ps
add a comment |
I'm running the sleep command in terminal using screen and in detached mode.
Once the screen immediately returns, I'm running ps
command to verify the sleep is running.
$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps
But the command didn't show sleep. What is that I'm doing wrong here?
scripting gnu-screen ps
why would you want to runsleep
through a detachedscreen
? couldn’t you just run it assleep 2m &
directly from your shell ? besides,ps
alone shows only processes belonging to your terminal window, while whatever you run throughscreen
will belong to a different virtual terminal
– LL3
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried usingps -a | grep sleep
still it is not showing any new process running sleep.
– Rajkumar Natarajan
1 hour ago
add a comment |
I'm running the sleep command in terminal using screen and in detached mode.
Once the screen immediately returns, I'm running ps
command to verify the sleep is running.
$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps
But the command didn't show sleep. What is that I'm doing wrong here?
scripting gnu-screen ps
I'm running the sleep command in terminal using screen and in detached mode.
Once the screen immediately returns, I'm running ps
command to verify the sleep is running.
$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps
But the command didn't show sleep. What is that I'm doing wrong here?
scripting gnu-screen ps
scripting gnu-screen ps
edited 1 hour ago
fra-san
2,0271721
2,0271721
asked 2 hours ago
Rajkumar NatarajanRajkumar Natarajan
1347
1347
why would you want to runsleep
through a detachedscreen
? couldn’t you just run it assleep 2m &
directly from your shell ? besides,ps
alone shows only processes belonging to your terminal window, while whatever you run throughscreen
will belong to a different virtual terminal
– LL3
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried usingps -a | grep sleep
still it is not showing any new process running sleep.
– Rajkumar Natarajan
1 hour ago
add a comment |
why would you want to runsleep
through a detachedscreen
? couldn’t you just run it assleep 2m &
directly from your shell ? besides,ps
alone shows only processes belonging to your terminal window, while whatever you run throughscreen
will belong to a different virtual terminal
– LL3
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried usingps -a | grep sleep
still it is not showing any new process running sleep.
– Rajkumar Natarajan
1 hour ago
why would you want to run
sleep
through a detached screen
? couldn’t you just run it as sleep 2m &
directly from your shell ? besides, ps
alone shows only processes belonging to your terminal window, while whatever you run through screen
will belong to a different virtual terminal– LL3
1 hour ago
why would you want to run
sleep
through a detached screen
? couldn’t you just run it as sleep 2m &
directly from your shell ? besides, ps
alone shows only processes belonging to your terminal window, while whatever you run through screen
will belong to a different virtual terminal– LL3
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using
ps -a | grep sleep
still it is not showing any new process running sleep.– Rajkumar Natarajan
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using
ps -a | grep sleep
still it is not showing any new process running sleep.– Rajkumar Natarajan
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
screen
expected the command in the first argument; what you gave as that first argument was: 'sleep 2m
', so it tried to execute a command named (exactly) 'sleep 2m
', as opposed to what you really wanted, which was sleep
with an argument of 2m
. The screen command exited successfully, but it did not successfully execute your command.
Use, instead:
screen -d -m sleep 2m
Instead of ps
, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:
ps x
which will show it:
$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f511443%2fsleep-command-using-command-is-not-displayed-in-ps%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
screen
expected the command in the first argument; what you gave as that first argument was: 'sleep 2m
', so it tried to execute a command named (exactly) 'sleep 2m
', as opposed to what you really wanted, which was sleep
with an argument of 2m
. The screen command exited successfully, but it did not successfully execute your command.
Use, instead:
screen -d -m sleep 2m
Instead of ps
, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:
ps x
which will show it:
$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...
add a comment |
screen
expected the command in the first argument; what you gave as that first argument was: 'sleep 2m
', so it tried to execute a command named (exactly) 'sleep 2m
', as opposed to what you really wanted, which was sleep
with an argument of 2m
. The screen command exited successfully, but it did not successfully execute your command.
Use, instead:
screen -d -m sleep 2m
Instead of ps
, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:
ps x
which will show it:
$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...
add a comment |
screen
expected the command in the first argument; what you gave as that first argument was: 'sleep 2m
', so it tried to execute a command named (exactly) 'sleep 2m
', as opposed to what you really wanted, which was sleep
with an argument of 2m
. The screen command exited successfully, but it did not successfully execute your command.
Use, instead:
screen -d -m sleep 2m
Instead of ps
, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:
ps x
which will show it:
$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...
screen
expected the command in the first argument; what you gave as that first argument was: 'sleep 2m
', so it tried to execute a command named (exactly) 'sleep 2m
', as opposed to what you really wanted, which was sleep
with an argument of 2m
. The screen command exited successfully, but it did not successfully execute your command.
Use, instead:
screen -d -m sleep 2m
Instead of ps
, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:
ps x
which will show it:
$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...
answered 1 hour ago
Jeff Schaller♦Jeff Schaller
44.8k1163145
44.8k1163145
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f511443%2fsleep-command-using-command-is-not-displayed-in-ps%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
why would you want to run
sleep
through a detachedscreen
? couldn’t you just run it assleep 2m &
directly from your shell ? besides,ps
alone shows only processes belonging to your terminal window, while whatever you run throughscreen
will belong to a different virtual terminal– LL3
1 hour ago
@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using
ps -a | grep sleep
still it is not showing any new process running sleep.– Rajkumar Natarajan
1 hour ago