Questions tagged [sleep]

a command for delaying execution of a program for the given length of time. For low power mode, use *suspend* instead.

Filter by
Sorted by
Tagged with
0
votes
1answer
82 views

Press ENTER to continue

I want to know if there is any way to make my script stop until the user hits the Enter key, but without using the command read, just by the options of stty. I was wondering a code for this and got ...
1
vote
0answers
24 views

Errors running “nordvpn connect” on Wake from Suspend

I'm running Pop!_OS, a Ubuntu based OS, and I want to run nordvpn disconnect before suspend and nordvpn connect after suspend. I'm using code from this arch linux wiki and can't get the nordvpn ...
1
vote
0answers
12 views

Fedora/ Gnome: Disable sleep when undocking

Ask: I am looking for a way to stop my Fedora 32 notebook from going to sleep when I remove the external monitor (lid is always closed, it is always plugged in) Use case: I have a WFH setup where I ...
1
vote
1answer
13 views

Can't exec mplayer as a background process

If I give a command like: $ mplayer ~/sounds/mysound.wav then it works and plays a sound. If I sleep before playing the sound, then it also works: $ sleep 5s && mplayer ~/sounds/mysound.wav ...
13
votes
2answers
650 views

bash script: fixed sleep time is adding up in while loop

I am new to bash scripting and started out with a few sample scripts. One is: #!/bin/bash SECONDS=5 i=1 while true do echo "`date`: Loop $i" i=$(( $i+1 )) sleep $SECONDS ...
0
votes
0answers
8 views

Sleep/Suspend Problem on Acer V3-574G on KDE Neon

The suspend option on my Acer V3-574G laptop is not working on KDE neon. Whenever I click shut down, it just logs me out and the whole computer is awake with the lock screen showing. But, one thing I ...
0
votes
1answer
30 views

How to measure total cumulative time spent in sleep()?

I am analyzing a tool written in bash and python. The call from the top traverses through many layers of bash and python programs. The time to completion is in the order of hours (4-5 hours). In these ...
0
votes
0answers
13 views

initscripts installed but not found

In my Mint18, I have installed initscripts using apt-get command so that I can use usleep [time] in a bash script. However, I get the error usleep: command not found. I reinstalled initscripts using ...
1
vote
0answers
39 views

Kubuntu 20.04 randomly will not turn screen on when resuming from sleep

lspci -k output: https://pastebin.com/AhGX7SKd Computer Type: Laptop: Lenovo E585 GPU: Vega 10 CPU: Ryzen 7 2700U RAM: 8gb Operating System & Version: Kubuntu 20.04, manjaro 20.0, xubuntu ...
1
vote
0answers
32 views

ps command output, WCHAN column '-' for all processes

ps axo ppid,pid,stat,wchan,cmd outputs - for the WCHAN column for all processes, including the ones in sleep, on Debian bullseye, did I do something wrong? BTW, wchan shows 'the kernel function in ...
1
vote
1answer
30 views

pause a program (bash script) to a certain time

I want to pause a certain bash script for 30 minutes. Right now I use sleep 1800 but that doesn't take into account time the laptop might be in suspend (sleep) state. Is there way to achieve this? If,...
-1
votes
2answers
50 views

why ps not see sleep process?

I creart the first terminal , then I use "sleep 1000 &" and I found it by "ps". The problem is when I creat the second terminal and put "ps" ,there is no sleep process. I want to know why ? (my ...
0
votes
0answers
20 views

New Ubuntu 18.04 install won't go in to sleep mode

I installed Ubuntu 18.04 Desktop on a Lenovo ThinkPad Yoga that I was previously using Windows 10 on. Everything is working normally except sleep mode. When I put the laptop to sleep it shuts off and ...
0
votes
0answers
20 views

Execute POST Request Before System Sleep/Wakeup

I'm trying to use a script to shut off a smart plug I have when the system goes to sleep and turn it back on when the system wakes up. I've put the following script inside /lib/systemd/system-sleep/ ...
0
votes
0answers
150 views

systemd target Sleep should be reached AFTER target Suspend… right?

This has been nagging me for years. In syslog when suspending: Feb 20 05:45:12 alien systemd[1]: Started TLP suspend/resume. Feb 20 05:45:12 alien systemd[1]: Reached target Sleep. Feb 20 05:45:12 ...
1
vote
1answer
24 views

How to get sleep time of a program

I am trying to collect some statistics for a script that I run on a daily bases. I would like to get the amount of time that is actually spent sleeping. Is there a way to just get the sum of all sleep ...
0
votes
2answers
72 views

poll for the right output of a command

completely new to bash so any assistance is much appreciated. I'm looking for a script to do the following, its a pretty simple script but I cant seem to get it: I want to run a command, this command ...
0
votes
1answer
121 views

Kubuntu 19.10 black screen after wake up

I just got a new Laptop at work and installed a clean Kubuntu 19.10 on it. There is this problem: everytime I close the lid and reopen in or put it in sleep mode manually and attempt to wake it up, ...
2
votes
0answers
463 views

How to disable systemd-logind from watching hardware keys?

This laptop is acting as a server, so these are not only completely irrelevant and unnecessary, but also a serious PITA because the server was suspending when I closed the lid. I've set them to "...
0
votes
0answers
84 views

How do I hibernate my Centos 7 system?

I am looking online and it tells me that I should run systemctl hibernate but all I get is Failed to execute operation: Sleep verb not supported Need some guidance as to what I should do.
0
votes
1answer
48 views

Run a simple script during sleep/suspend

How can I have a simple bash script run during sleep? The script is pinging a machine on the network every 5 seconds, and if it is online, it will wake the computer from sleep. Is this possible on ...
-1
votes
1answer
528 views

Wifi issue after sleep

I am running Linux Mint 19 Tara. I cannot understand why but lately my wifi stop working after I resume it from sleep, the only way to make it work is either a reboot or sudo /etc/init.d/network-...
1
vote
1answer
176 views

hrtimer_nanosleep explanation

I have searched the Internet and did not find any explanation for hrtimer_nanosleep. What is the usage of this function and how does it differ from the clock_nanosleep API? Can someone please explain ...
1
vote
1answer
89 views

Piped command hangs on killed sleeping child

I use a 'watchdog' function to perform a failsafe wakeup if a certain command hangs. This is implemented by running a background task that sleeps for 30s and then executes the wakeup. If the parent ...
1
vote
2answers
2k views

create a systemd startup script that delays 30 minutes

I tried to create a systemd startup script that starts an rkhunter scan 30 minutes after system start of my laptop, like this: [Unit] Description=starts rkhunter and displays any findings with zenity ...
1
vote
2answers
627 views

sleep system call on Linux - interaction with signals

I have a question about the documentation of sleep, on Linux OS. man 3 sleep says: regarding thread safety, sleep() is "MT-Unsafe sig:SIGCHLD/linux", which means that on Linux sleep() may ...
3
votes
1answer
92 views

Is 'sleep' based on the system clock or on time elapsed?

Is 'sleep' based on the system clock or on time elapsed? For example, if you execute: sleep 1200 And immediately suspend your system for 10 minutes, will it end in another 10 minutes, or will it ...
0
votes
0answers
131 views

Can a signal in one thread, interrupt sleep period of another thread of the same process in linux

There are two threads (parent thread and child thread, both runs in their own infinite loop) in a process. The parent thread does only one work, i.e. to continuously (while(1)) check the system time ...
0
votes
1answer
766 views

Not able to hibernate or suspend centos system

I am running Centos 7 and all I want to do is make my computer go to sleep immediately. There is a setting I have set to make my computer go to sleep but only after a certain amount of inactivity but ...
0
votes
2answers
80 views

bash remove members Slack from channels using xargs and sleep?

I'd like to be able to remove a batch of people from a "private" Slack channel. Use case: whoops, I just added 137 people to the wrong channel! The Slack Member ID list is obtained from an Airtable ...
3
votes
0answers
289 views

Suspend delayed after lid close

For some reason, when I close my laptop lid, it takes my system 25 seconds to sleep. This is without any autolock prorams (xss-lock, xautolock, etc.) running. In my journalctl I can see exactly a 25 ...
1
vote
1answer
656 views

Can't suspend Debian machine: wakes up immediately after sleep (“PM: Device usb1 failed to suspend async”)

Since I installed the latest Debian updates yesterday (udev, systemd, ...) I can't put my Debian 9/KDE machine to sleep. It wakes up immediately after suspending (systemctl suspend). /var/log/syslog ...
4
votes
3answers
678 views

Terminate BASH For loop, that contains long sleep and other stuff, using any specific key

I have a bash script that has a for loop that iterates a lot of times and sleeps between iterations, potentially for a long time. It then writes results to a file, then terminates. On occasion I ...
3
votes
2answers
735 views

How to quit command prompt after a sleeping command executes?

I have a simple script: f=1 # initial value loop(){ ... if [[ $f -eq 1 ]] then echo $msg1 f=2 (sleep $interval; loop) & exit 1 elif [[ $f -eq 2 ]] ...
1
vote
2answers
117 views

Sleep certain sections of the script

I want to pause/sleep the elif part but keep the other elif parts working . I don't want the whole script to sleep if 1 sensor goes off. #!/bin/sh while true; do valid="" scan=`./script` ...
0
votes
0answers
42 views

How to determine if guest OS is suspended when running as virtual machine

Running CentOS 7 and in need to do some network related commands when suspended and resumed by the VMWare. Thus far all the solutions I have seen, is connected to pm-utils. But nothing appears to ...
0
votes
1answer
2k views

gdm3: Failed to parse options: Unknown option -reset (Ubuntu 18.04)

I'm having the same issue as described here: my computer won't wake up after I lock the screen or put it to sleep. One of the answers suggests running sudo gdm3 -reset, which I tried. But just as some ...
22
votes
10answers
13k views

Shell: is it possible to delay a command without using `sleep`?

Are there any substitutes, alternatives or bash tricks for delaying commands without using sleep? For example, performing the below command without actually using sleep: $ sleep 10 && echo "...
7
votes
3answers
2k views

sleep, wait and Ctrl+C propagation

If I have the following shell script sleep 30s And I hit Ctrl+C when the shell script is running, the sleep dies with it. If I have the following shell script sleep 30s & wait And I hit Ctrl+...
33
votes
6answers
9k views

Running a loop precisely once per second

I'm running this loop to check and print some things every second. However, because the calculations take maybe a few hundred milliseconds, the printed time sometimes skip a second. Is there any way ...
0
votes
1answer
51 views

What does `sleep` with multiple arguments mean?

I was wondering what differences are between sleep 1 2 3 and sleep 6 ? They seem the same. Thanks.
-3
votes
1answer
28 views

Differencess in process tree after stop session for few mins [closed]

Stop executing session for 3 mins with the sleep command and show differences in the process tree (with + symbol for new processes and - symbol for those which are gone). How to write a script for ...
2
votes
1answer
89 views

Prevent battery drain from constant write IO churn by browsers

For some reason, common browsers (Chromium is particularly bad, but Firefox isn't much better) generate constant IO load, particularly writes, on my Debian system. This is the case even when the ...
1
vote
1answer
1k views

Bash script not sleeping when running scripts in parallel

I have several bash scripts that I need to run in parallel. However, they are memory hogs so I would like to stagger each of them by 30 seconds but still run in parallel. For example: hourr=($(seq 0 ...
2
votes
0answers
267 views

system does not sleep and does not wake up

I recently bought a new HP ENVY x360 with AMD Ryzen 5 2500U CPU. So many driver support problems on Linux. I tried lots of distributions but none works. The main problem is that the laptop won't ...
3
votes
0answers
107 views

zfs pool not available on boot after setting noatime and drive idle times with hd-idle / hdparm

At first, I set up my RHEL7-x64 to sleep the zfs drives using this,this, and this. I believe I tried hd-idle first, when the problems began. I had written a script idle_drives_enable to handle ...
0
votes
2answers
147 views

MSI B150M Pro-VD mobo hangs on suspend in Linux Mint

I can't restore my Linux Mint 18.3, (Kernel v4.13.0-32-generic x86_64 running on a MSI B150M PRO-VD (MS-7996) v1.0 mobo), from sleep mode. Last messages on screen (at same second): [19.....] ...
-1
votes
1answer
824 views

Sometimes it's convenient to use ` read -t 3 ` instead of ` sleep 3 `. How do I make it work with `nohup`?

Sometimes it's convenient to use read -t 3 instead of sleep 3. How do I make it work with nohup? nohup bash -c ' date; read -t 3; date ' | tail -n 2 nohup.out As you can see, read -t 3 does not wait ...
1
vote
1answer
292 views

Slackware 14.2 - black screen after waking from sleep/lock - what process controls sleep/lock?

I have had Slackware 14.2 32bit installed on a netbook with LXDE as my main DE for about a month now. My main issue is that sometimes the screen is black on waking from sleep [suspend] and the only ...
2
votes
1answer
413 views

Bash `sleep` outputs __bp_preexec_invoke_exec

Background I'm running a larger one-line command. It is unexpectedly outputting (twice per iteration) the following: __bp_preexec_invoke_exec "$_" Here is the pared down command (removed other ...