1

I tried run the code , but php still wait for the "transfer" script to execute finish before it proceed, it doesn't run the node in silence and proceed to run the next command, but rather it wait for it execute finish and get it response.

How do i run it in silence like nohup & without having my php script to wait for the execution.

Thank you

$shell_cmd = "node --no-warnings /var/www/html/startBot/transfer.js $this_wallet_priv $this_first_wallet_addr $first_send > /dev/null 2>&1";
shell_exec($shell_cmd);

echo "CMD1 : $shell_cmd \n";
CMD1 : node --no-warnings /var/www/html/startBot/transfer_bnb.js wallet_priv wallet_address 0.0048125 > /dev/null 2>&1
Sammitch
  • 30,782
  • 7
  • 50
  • 77
Zack D
  • 23
  • 4
  • Have a look https://stackoverflow.com/questions/1019867/is-there-a-way-to-use-shell-exec-without-waiting-for-the-command-to-complete – endo64 May 15 '23 at 15:36
  • 1
    You need to add a `&` at the end for it to fork a new process – Rob Eyre May 15 '23 at 15:41

1 Answers1

0
node --no-warnings /var/www/html/startBot/transfer_bnb.js $this_wallet_priv $this_second_wallet_addr $first_send > /dev/null 2>/dev/null &

This above is the correct way

Zack D
  • 23
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Parking Master May 15 '23 at 22:37