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

learn more… | top users | synonyms

12
votes
2answers
4k views

How to run systemd user service to trigger on sleep (aka. suspend, hibernate)?

Based on various sources I have cobbled together ~/.config/systemd/user/screenlock.service: [Unit] Description=Lock X session Before=sleep.target [Service] Environment=DISPLAY=:0 ExecStart=/usr/bin/...
11
votes
8answers
6k views

cron Vs. sleep - which is the better one in terms of efficient cpu/memory utilization?

The Case: I need to run some commands/script at certain intervals of time and for this I have two options: set up a cron-job implement a loop with sleep in the script itself. Question: Which is ...
9
votes
3answers
519 views

Perform command every X seconds

I wish to perform a command ever 10 seconds, and have it executed in the background (thereby eliminating watch?). All the answers show something like the following, but this will execute ever 11 to ...
9
votes
5answers
8k views

Avoiding busy waiting in bash, without the sleep command

I know I can wait on a condition to become true in bash by doing: while true; do test_condition && break sleep 1 done But it creates 1 sub-process at each iteration (sleep). I could ...
8
votes
2answers
2k views

How to power off a system but still keep it available on the network

I'm looking into installing a file server on my network, for serving data and backups. I want this machine to be available at all times, but I would rather not keep it on all the time (as to conserve ...
7
votes
2answers
2k views

What is a good way of saying “run this after 15 minutes” on a shell?

I use this sleep 900; <command> on my shell. Just wanted to know is there is some alternate/better way that you use?
7
votes
3answers
568 views

What's the difference between && and ; when forking sleep to background?

I have just asked a question about forking a process to sleep in the backgroud. The notation I came up with myself looks like this: sleep 10 && echo "hello world" & This answer to a ...
6
votes
3answers
5k views

Sleep until next occurrence of specific time

I need a series of commands or a single command that sleeps until the next occurrence of a specific time like "4:00" occurs. How would I do that? The at command or a cronjob is not a option because ...
5
votes
1answer
33k views

Adding Sleep command to shell script?

How can I add a 10sec sleep to my loop after each page is processed? #!/bin/sh for page in {1..50} do wget -q -U Mozilla "http://admin.domain.com/products_search/?p=$page" -O - \ | tr '"' '\...
5
votes
2answers
3k views

How preemption works on Linux when a program has a timer less then 4ms?

Jiffies in most Linux system are defaulted to 250 (4ms). The questions is that what happens when a program has a usleep() less then 4ms ? Of course it works as should when it is scheduled. But what ...
5
votes
1answer
1k views

Wake monitor from sleep remotely

I have an Ubuntu server running xdm with openbox on which is plugged a monitor that displays a video which is launched via a cron daemon. When the monitor is not used for a certain amount of time, it ...
4
votes
2answers
378 views

status check for sleep command

I have run sleep command in background as follow , How can I know the status of execution ..? Command sleep 2d ; find /home/disk1/ -exec touch {} \; & How can I know that its executed for 1 ...
4
votes
1answer
2k views

auto reconnect VPN on waking up

When I wake up my computer, the internet automatically reconnects, however the VPN does not. Is it possible to make it automatically reconnect (using the network manager on KDE, or at least in a way ...
4
votes
1answer
263 views

How can I display uptime with sleep-mode time excluded?

I put my laptop to suspend mode, woke it up later, and now it shows uptime some 23 hours (with uptime), which is obviously not true. I suspect uptime simply returns the difference between the ...
3
votes
3answers
387 views

How to sleep until a given date & time?

I want to write a shell where given a date (day-hour-min) e.g. 10:00 AM Sun 2:30 PM Mon ... It sleeps until that exact date & time. I thought one way of doing it is, I could get the current ...
3
votes
1answer
1k views

Closing lid on Crunchbang

I'm running Crunchbang on a laptop. I can't seem to find an option to toggle if the laptop goes to sleep when the lid closes. There are certain times where I want to put the laptop away or close it ...
3
votes
1answer
1k views

Python script run while screen is locked

I have a python script which seems to be failing to continue running its while True: ... sleep() loop my code is at http://github.com/xdaimon/xdaimonConky What happens is I autostart python on ...
3
votes
1answer
2k views

Why a sleep 300 (5 minutes) can last several hours some time? [closed]

I have a MiniMac with the OSX system. My script is: while true do echo "Sleep 300 seconds = 5 minutes" date sleep 300 echo "end of sleep" date done I want it to repeat every 5 minutes; ...
3
votes
1answer
827 views

Kubuntu doesn't reconnect to Wifi after waking up from sleep

I just installed Kubuntu on my laptop and it's working fine so far, except the wireless connection is not switched on after waking up from sleep. I do have to click "Enable wireless" so that it ...
3
votes
1answer
570 views

Plotting the sleep/wait chain of a process

I often want to know why a process in the middle of a pipeline is sleeping and not busy processing data. My current method is: find the pid of interest sudo strace -pt pid to get the blocking ...
3
votes
0answers
88 views

How do I find out what process is putting my machine to sleep?

My laptop is going to sleep after about 10 minutes of inactivity, and I don't know why. I verified the standard power options, are they're not set to put my machine to sleep. Here is grep's output ...
3
votes
0answers
213 views

Sleep key stops working after some time

I've got a "Sleep" key on my keyboard that I use to suspend the system when I'm away from the computer for a longer time. This works fine, at least for a while after I've turned the computer on. ...
2
votes
2answers
402 views

Different sleep binaries on Mac (Darwin) and in Linux. How to properly handle the differences?

In my Linux box, sleep accepts seconds, minutes and hours. So: sleep 10m Sleeps for 10 minutes (or 600s). sleep on Mac only accepts seconds as argument. sleep 10m doesn't work, only sleep 600s. ...
2
votes
1answer
975 views

Screen fading out on GNOME, without ability to cancel

Sometimes, on my Arch Linux laptop, using GNOME for the desktop, my screen will fade out after a while of non-activity (even if I'm watching a video). This fade out is very slow, and can't be ...
2
votes
3answers
850 views

The only way to turn off/on wifi is to put laptop into sleep mode

After start GNOME prints Hardware disabled. I've tried to use keyboard shortcut and it doesn't work. Only way to disable/enable hardware wifi is to put laptop into sleep mode and restore.
2
votes
4answers
415 views

How to influence a bash while loop with a timed global variable?

I have a while loop in a bash script which should do something different at the beginning and at every 5 second interval. Any previous loop is allowed to complete. The 5s interval is indicated by the ...
2
votes
1answer
110 views

Linux Fedora: can I preserve what I am doing so that everything will be restored when I power up again

I have Linux Fedora 20, with Gnome classic desktop. When I power down, via the "Power Down" icon on the top bar, everything shuts down, and everything is gone when I power up again, although I can ...
2
votes
1answer
3k views

Script to SCP files works manually but not through cron

I'm using CentOS 5.6. The below code might have some typos as I needed to change real info to fake info for security reasons: backup.sh #!/bin/bash set -vx rm -v /server/temp_db.gz rm -v /server/...
2
votes
0answers
406 views

How to use systemd hybrid-sleep instead of suspend under GNOME in Linux? [closed]

How can I make GNOME 3 use systemd hybrid-sleep instead of suspend, when closing the lid or using suspend from the menu?
2
votes
1answer
260 views

Is uninterruptible sleep the only case?

French wikipedia say: Un processus en sommeil ininterruptible ne peut s'arrêter (ni libérer ses ressources) même lorsque SIGKILL apparaît. Il s'agit d'un des rares cas dans lequel un système ...
2
votes
0answers
304 views

Waking an Ibook G4 (powerpc) running Debian Linux from suspend based on timer

I have recently received an Ibook G4 from a friend. I plan to use it as a server and have installed Debian Wheezy (7.0.0, release version) on it. However, I would like to suspend it at some points ...
2
votes
0answers
105 views

How to know when a device is ready

I have firewire mixing console and I wrote an udev rule which calls a script to set up the whole audio chain (alsa -> pulseaudio -> jackd -> firewire) as soon an the console is switched on. Now I ...
1
vote
3answers
93 views

How to Distribute Computing of `tar czf` for Longer Time?

My systems go under heavy load when I run sudo tar czf /media/masi/ntfsDisc/backup_home.tar.gz $HOME/ Fans goes to max etc. I would like to find a better balance between computing and power ...
1
vote
4answers
373 views

Faster delayed execution than 1 minute?

I am working on a program that can "upgrade itself" by install a new package. In order to accomplish this, I am using the at command to specify that a shell script should be run one minute in the ...
1
vote
2answers
71 views

the “done” message after a &-command is not displayed right away, but after a user action. Why?

I do a sleep 3 & and the "done" message is displayed as part of the ps command, not right on the console. It doesn't have to be ps. Any command after the sleep is done will have an extra line at ...
1
vote
1answer
145 views

shell sleep until next full minute

To execute a script on the next full minute I want to tell the sleep command to sleep until the next full minute. How can I do this?
1
vote
1answer
313 views

Types of sleep modes for processes

I came across this while troubleshooting why our server is doing down everytime the oracle process is killed. I listed the oracle process running on the server using ps aux | grep oracle and here is ...
1
vote
2answers
952 views

Computer doesn't wake from sleep mode

I have a laptop with Linux Slackware 14, KDE 4.8.5, kernel 3.9.0-rc6. When I close the lid and pull out the power cord, the machine goes into sleep mode. When I wake it, plugging the cord back in and ...
1
vote
1answer
1k views

Alternative for `sleep seconds` that takes system load into account?

So I develop my server app and some client apps for it. After each rebuild I start my server (which tends to load qup all services for something like 2 seconds) and then I start my clients... So his ...
1
vote
2answers
94 views

Batch timeout alternative?

What I need is an 80 seconds sleep, that I could skip by hitting a key. Being able to see the remaining time would be a plus.
1
vote
1answer
512 views

Cannot use computer after Linux mint goes to hibernate

I am running Linux Mint on my Laptop (MacBook Pro 2015 dual booting with Yosemite) however when I put my lid down I have the setting set to 'Hibernate'. The issue is when I put the lid down I cannot ...
1
vote
1answer
262 views

debian testing hangs on wakeup from s2disk / hibernate

My machine (ThinkPad x230) hangs on wake up from s2disk or s2ram after a recent aptitude safe-upgrade.† The hang looks like a blank screen with a blinking cursor in the upper right after loading data ...
1
vote
0answers
40 views

Check if laptop is asleep

Does anyone know to check via SSH or bash script whether or not my laptop has "fallen asleep". For some reason whenever my laptop falls asleep my drawings (on /dev/fb0) are over ridden by the ...
1
vote
0answers
30 views

Ubuntu VPS in sleep mode / standby?

I currently have a problem with my VPS (ubuntu 14.04.4). When I access it after hours the first time again via HTTP or SSH it takes a few seconds until it reacts, sometimes it is even too long, so it ...
1
vote
0answers
54 views

C shell. Make script wait for Gnome-terminal to finish

I am working on a script that has to process a lot of data. All comes down to 3 commands. I use: #!/bin/csh gnome-terminal -e "ssh $servername1 'command 1'" & gnome-terminal -e "ssh $servername2 ...
1
vote
0answers
294 views

How to prevent automatic external hard-drive unmount

I am running some simulations in Matlab on a Linux machine (running Debian Gnome v3.4.2). All the scripts and heavy .mat files are in an external 1TB Toshiba hard-drive connected through USB 3.0 to ...
1
vote
0answers
260 views

udevadm trigger runs only one rule

I have 1294:1320 RISO KAGAKU device on F17. The problem is after sleep/resume hid reclaims this device back and its udev rule is ignored. If I unplug and plug in the device it is OK until next sleep/...
1
vote
0answers
2k views

CentOS 6.5 will not sleep after period of inactivity

I've recently upgraded my Ubuntu 12.04 LTS to CentOS 6.5. This is a desktop PC (non-server) that I would like to sleep/power down after a period of inactivity. I have the following settings in my ...
1
vote
3answers
3k views

Use DD-WRT to auto WOL when traffic is on same subnet

So i've seen the WOL scripts and they seem like they could work well when i'm trying to connect from a computer that is outside my router. Script i'm using: http://www.dd-wrt.com/wiki/index.php/...
1
vote
0answers
145 views

Debian Mouse Preference?

I just loaded Debian onto a live usb today for the first time. I successfully killed my laptops annoying trackpad with the synclient command, but now I can't figure out how to get Debian to stop ...