user_create_post & starting daemon

Freek

New member
Joined
Mar 6, 2013
Messages
2
Hi there,

I am trying to start a memcached daemon in the user_create_post however this hangs the create process for as long as I dont kill the freshly spawned daemon. I tried using nohup but this makes no difference.

Any ideas?
 
Its probably not forking to the background. If thats what you want you need to end the command in the & sign. What does your command look like.

It should be something like:

Code:
/path/to/command.sh &

or

Code:
/path/to/nohup /path/to/command.sh &
 
Hello,

I don't remember where from I did get this, nevertheless it's working:

##########################################

If you need to execute code a few seconds after the sh script it call
this code is a basic example on how to throw the script into the background
The foreground instance of it will close all file descriptors, then call
the background function, then exit. Becuase of the & character, the
background function is put in the background and runs until it's done.

==================================

Code:
#!/bin/bash

function back(){
    sleep 5
    echo $0 `date` background  >/tmp/da_scripts
}

echo $0 `date` start >/tmp/da_scripts

#closing all FDs
exec 0>&-
#this is important
exec 1>&-
exec 4>&-

back &
exit 0
 
Back
Top