sleep command using command is not displayed in ps The 2019 Stack Overflow Developer Survey Results Are InUnable to 'stuff' commands into a created 'screen' immediately after creating itRunning background process with screen command in xshellscreen command not showing status barCapturing screen of “perf top” or other interactive programsRunning repetitive task through Bash scriptbash - get pid for a script using the script filenameStart detached screen session with more than 80 columns?Unable to initiate screen sessionHow do I un-freeze my vim session under screenSearch for running script PID by script name
Where to refill my bottle in India?
Deadlock Graph and Interpretation, solution to avoid
Pristine Bit Checking
On the insanity of kings as an argument against Monarchy
Can we apply L'Hospital's rule where the derivative is not continuous?
Does a dangling wire really electrocute me if I'm standing in water?
Geography at the pixel level
Time travel alters history but people keep saying nothing's changed
Feasability of miniature nuclear reactors for humanoid cyborgs
How to create dashed lines/arrows in Illustrator
What is the best strategy for white in this position?
How was Skylab's orbit inclination chosen?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Could JWST stay at L2 "forever"?
Why Did Howard Stark Use All The Vibranium They Had On A Prototype Shield?
Where does the "burst of radiance" from Holy Weapon originate?
What is the meaning of Triage in Cybersec world?
Polarization lost upon 2nd reflection?
It's possible to achieve negative score?
Output the Arecibo Message
Lethal sonic weapons
What do hard-Brexiteers want with respect to the Irish border?
Monty Hall variation
The difference between dialogue marks
sleep command using command is not displayed in ps
The 2019 Stack Overflow Developer Survey Results Are InUnable to 'stuff' commands into a created 'screen' immediately after creating itRunning background process with screen command in xshellscreen command not showing status barCapturing screen of “perf top” or other interactive programsRunning repetitive task through Bash scriptbash - get pid for a script using the script filenameStart detached screen session with more than 80 columns?Unable to initiate screen sessionHow do I un-freeze my vim session under screenSearch for running script PID by script name
.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 runsleepthrough a detachedscreen? couldn’t you just run it assleep 2m &directly from your shell ? besides,psalone shows only processes belonging to your terminal window, while whatever you run throughscreenwill belong to a different virtual terminal
– LL3
11 hours 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 sleepstill it is not showing any new process running sleep.
– Rajkumar Natarajan
10 hours 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 11 hours ago
fra-san
2,0271721
2,0271721
asked 11 hours ago
Rajkumar NatarajanRajkumar Natarajan
1447
1447
why would you want to runsleepthrough a detachedscreen? couldn’t you just run it assleep 2m &directly from your shell ? besides,psalone shows only processes belonging to your terminal window, while whatever you run throughscreenwill belong to a different virtual terminal
– LL3
11 hours 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 sleepstill it is not showing any new process running sleep.
– Rajkumar Natarajan
10 hours ago
add a comment |
why would you want to runsleepthrough a detachedscreen? couldn’t you just run it assleep 2m &directly from your shell ? besides,psalone shows only processes belonging to your terminal window, while whatever you run throughscreenwill belong to a different virtual terminal
– LL3
11 hours 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 sleepstill it is not showing any new process running sleep.
– Rajkumar Natarajan
10 hours 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
11 hours 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
11 hours 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
10 hours 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
10 hours 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 10 hours ago
Jeff Schaller♦Jeff Schaller
44.8k1164146
44.8k1164146
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
sleepthrough a detachedscreen? couldn’t you just run it assleep 2m &directly from your shell ? besides,psalone shows only processes belonging to your terminal window, while whatever you run throughscreenwill belong to a different virtual terminal– LL3
11 hours 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 sleepstill it is not showing any new process running sleep.– Rajkumar Natarajan
10 hours ago