<div dir="ltr">no I don't have dependency treated.<br><br>during the job, I would like to run a program on the machine running the job<br>but I'd like the program to keep running even after the job ends.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-06-04 15:30 GMT+02:00 John Hearns <span dir="ltr"><<a href="mailto:hearnsj@googlemail.com" target="_blank">hearnsj@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Tueur what are you trying to achieve here?  The example you give is<span class="m_-11226471504385244gmail-m_-2665505057655900136gmail-s">           touch /tmp/newfile.txt' <br></span></div><div><span class="m_-11226471504385244gmail-m_-2665505057655900136gmail-s">I think you are trying to send a signal to another process. Could this be 'Hey - the job has finished and there is a new file for you to process'</span></div><div><span class="m_-11226471504385244gmail-m_-2665505057655900136gmail-s">If that is so, there may be better ways to do this. If you have a post-processing step, then you can submit a job whihc depends on the main job.</span></div><div><span class="m_-11226471504385244gmail-m_-2665505057655900136gmail-s"><a href="https://hpc.nih.gov/docs/job_dependencies.html" target="_blank">https://hpc.nih.gov/docs/job_<wbr>dependencies.html</a><br></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 4 June 2018 at 15:20, Tueur Volvo <span dir="ltr"><<a href="mailto:huitre39@gmail.com" target="_blank">huitre39@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>thanks for your answer, i try some solution but it's not work</div><div><br></div><div>i try to add setsid and setpgrp for isolate my new process but slurm job sleep 6secondes and reboot my machine (i test with reboot command, but we can make other bash command, it's just example)</div><div><br></div><div>        pid_t cpid; //process id's and process groups<br><br>        cpid = fork();<br><br>        if( cpid == 0 ){<br>            setsid();<br>            setpgrp();<br>            execl("/bin/sh", "sh", "-c", "sleep 10; reboot1&", NULL);<br>            <br>        }<br>        wait(NULL);</div><div><br></div><div><br></div><div>maybe i have a error in my code ?<br></div></div><div class="m_-11226471504385244HOEnZb"><div class="m_-11226471504385244h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-05-31 9:37 GMT+02:00 Yair Yarom <span dir="ltr"><<a href="mailto:irush@cs.huji.ac.il" target="_blank">irush@cs.huji.ac.il</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm not sure how slurm/spank handles child processes but this might be<br>
intentional. So there might be some issues if this were to work.<br>
<br>
You can try instead of calling system(), to use fork() + exec(). If<br>
that still doesn't work, try calling setsid() before the exec(). I can<br>
think of situations where your process might still get killed, e.g. if<br>
slurm (or even systemd) kills all subprocesses of the "job", by<br>
looking at the cgroup. If that's the case, you'll need to move it to<br>
another cgroup in addition/instead of setsid().<br>
<span class="m_-11226471504385244m_1370820081454262057HOEnZb"><font color="#888888"><br>
    Yair.<br>
</font></span><div class="m_-11226471504385244m_1370820081454262057HOEnZb"><div class="m_-11226471504385244m_1370820081454262057h5"><br>
<br>
<br>
On Wed, May 30, 2018 at 5:16 PM, Tueur Volvo <<a href="mailto:huitre39@gmail.com" target="_blank">huitre39@gmail.com</a>> wrote:<br>
> Hello i have question, how run in background bash script in spank plugin ?<br>
><br>
> in my spank plugin in function : slurm_spank_task_init_privileg<wbr>ed<br>
><br>
> i want to run this script :<br>
><br>
> system("nohup bash -c 'sleep 10 ; touch /tmp/newfile.txt' &");<br>
><br>
> i want to run in independant process this bash script, i don't want wait 10<br>
> seconde in my slurm plugin<br>
><br>
> i have this code :<br>
> int slurm_spank_task_init_privileg<wbr>ed (spank_t sp, int ac, char **av) {<br>
><br>
> system("nohup bash -c 'sleep 10 ; touch /tmp/newfile.txt' &");<br>
><br>
> return 0;<br>
><br>
> }<br>
><br>
> actualy it's not work, when slurm ending to run my job, he kill my nohup<br>
> command<br>
><br>
> if i  had in my c code sleep 12, my bash script work<br>
><br>
><br>
> int slurm_spank_task_init_privileg<wbr>ed (spank_t sp, int ac, char **av) {<br>
><br>
> system("nohup bash -c 'sleep 10 ; touch /tmp/newfile.txt' &");<br>
><br>
> sleep(12);<br>
><br>
> return 0;<br>
><br>
> }<br>
><br>
> but i don't want to wait, i want to run my bash script in independant<br>
> process<br>
><br>
> thanks for advance for your help<br>
><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>