PDA

View Full Version : How to make executable run as deamon ?



ktheking
09-14-2003, 04:24 PM
Purpose is to let a bash script run in the background.
Any ideas anyone ?
Thanks already ...

ktheking
09-14-2003, 04:54 PM
Ok got it ....

put & right after the command.

ex. ls&

preventing it stop when logging off you have to use 'nohup'

ex. nohup ls&

Dave_Bechtel
09-15-2003, 05:25 AM
--Actually you can ' disown %1 ' or whatever the job # is instead. (This comes in very handy if you wanted unattended operation but forgot the nohup. ;-)) It's a bash internal command: (man bash)


disown [-ar] [-h] [jobspec ...]
Without options, each jobspec is removed from the table of
active jobs. If the -h option is given, each jobspec is not
removed from the table, but is marked so that SIGHUP is not sent
to the job if the shell receives a SIGHUP. If no jobspec is
present, and neither the -a nor the -r option is supplied, the
current job is used. If no jobspec is supplied, the -a option
means to remove or mark all jobs; the -r option without a job-
spec argument restricts operation to running jobs. The return
value is 0 unless a jobspec does not specify a valid job.


Ok got it ....

put & right after the command.

ex. ls&

preventing it stop when logging off you have to use 'nohup'

ex. nohup ls&

aay
09-15-2003, 11:11 PM
Another option is to use ctrl+z to put the process on hold and then "bg" to send it to the background. If you want to bring it back for some reason just use "fg" - foreground.