Questions tagged [sleep]
a command for delaying execution of a program for the given length of time. For low power mode, use *suspend* instead.
141
questions
0
votes
3answers
63 views
Why is the command sleep an independent process but others seemingly not when used in a shell script?
I'm writing a bash script named test.sh as below on my Ubuntu:
#!/bin/bash
while true; do
echo 'abc' # pwd, df...
sleep 1
done
When I execute ./test.sh at one terminal, I open another ...
1
vote
1answer
22 views
How Do I Set My Fedora KDE 33 Workstation To NOT Suspend Upon Lid Close?
My Fedora KDE 33 Workstation (Old Sony Vaio Book) suspends when I close it. I would like to listen to music with the lid closed, so how should I do this?
1
vote
2answers
78 views
How to kill a command run from a script after a period? [duplicate]
I would like to run a never-ending command (such as play a mp3 file in loop) for a period of length T.
I put the command in a shell script my.sh:
#! /bin/bash
vlc /path/to/my.mp3 # will play the file ...
0
votes
0answers
16 views
My screen gets “pixelated” after waking up from the sleep. (Zorion OS)
After waking up from sleep, my laptop's screen and all the apps that were running on it before going to sleep have distorted pixels.
0
votes
0answers
15 views
Suspend & Disabling a Device at Boot
System & OS: Ubuntu 20.10, Supermicro X11SPA-TF (see inxi dump below)
Problem description: Suspend to RAM does not work. The screen is blanked, but nothing else happens (the system doesn't power ...
1
vote
0answers
23 views
Keeping Linux Mint 19.1 Mate from putting the display to sleep
I am running Linux Mint 19.1 Mate on a computer running kiosk software. For the love of all things I cannot get it to stop putting the display to sleep. I have set Control Center Power Management ...
0
votes
0answers
10 views
automatic suspend not working when spotify is running
my dell e6410 running linux ulyana mate does not suspend automatically when spotify is running. i can make it do automatic suspend by running the "systemctl unmask" but have to do it ...
1
vote
2answers
85 views
sleep command delay grossly inaccurate (VM)
I need to use sleep in a shell script, so I tried it out in a terminal, but the delays it produces are inconsistent and very inaccurate. For example sleep 3 produces a delay close to 20 seconds. These ...
0
votes
0answers
79 views
Wifi not working after waking up from sleep mode Pop OS!
I installed Pop OS! recently, and every time I use my laptop after putting it in sleep mode, the WiFi does not work and it shows up as "No Wifi Adapter Found".
I tried to search and solve ...
0
votes
1answer
198 views
Pop! OS wakes up from suspend with a black screen
Release: 20.04, Gnome. Without grub. On a Lenovo IdeaPad Flex 5 (2020) 2-in-1. I found this thread advising to edit the grub file, but this distro doesn't have grub. Is there a similar file I could ...
0
votes
2answers
74 views
Verbose sleep command that displays pending time seconds/minutes?
sleep command can be used to introduce a delay. e.g. sleep 5 will sleep for 5 seconds.
Is there any alternative/way/method that will display the pending seconds on the terminal?
output like
resuming ...
0
votes
1answer
48 views
Disabled ipv6, but the setting doesn't persist after sleep
I added these lines to a .conf file in the directory /etc/sysctl.d
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
I then do sudo systemctl ...
0
votes
1answer
11 views
cron starts ev. min script, that sleeps some times for 1200s
I wrote a script, that sleeps some times for 1200s.
That script must be executed through cron every minute.
If my script pauses 1200s, will cron still start a new process?
If so, how can I set this to ...
0
votes
1answer
353 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
1answer
89 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
138 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
20 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
803 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
19 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
41 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
23 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
267 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
190 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
34 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
135 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
21 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
22 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
380 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
26 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
212 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
228 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
959 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
1answer
79 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
vote
2answers
1k 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
329 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
113 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
5k 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
1k 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
119 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
237 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
1k 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
91 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
390 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
843 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
930 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
1k 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
132 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
61 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 ...
23
votes
10answers
16k 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 "...