7
votes
7answers
2k 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 - 1. set up a cron-job or, 2. implement a loop with sleep in the script itself. Question: ...
5
votes
5answers
2k 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 ...
1
vote
1answer
681 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 ...
2
votes
1answer
2k 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 ...