Jump to content


Photo

Need help with pup exec


  • Please log in to reply
1 reply to this topic

#1 dwest100

dwest100
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 February 2017 - 04:10 AM

Code:

function set_server_jobs() {
$permalink = 'https://www.jameswes...gs.net/about/';
$auction_end_delayed = '23:40';
$curl_command = 'curl ' . $permalink . ' | at ' . $auction_end_delayed;
shell_exec("'" . $curl_command . "'");
//echo $curl_command;
}
add_shortcode('test_curl', 'set_server_jobs');


Question:
(Using Wordpress, thus the shortcode)
I'm trying to get $curl_command to execute on the server but it isn't working. I echoed the command for testing and it is concatenated correctly. When I run atq on the bash shell no job is listed...meaning none was created by the exec sent to the server.
What am I doing wrong?

Thanks!

Edited by dwest100, 13 February 2017 - 04:18 AM.


#2 requinix

requinix
  • Administrators
  • Confusing Administrator
  • 8,204 posts
  • LocationWA

Posted 13 February 2017 - 03:19 PM

I imagine that the job is being killed off when the shell exits.

Don't do this anyways. Use cron to set up a regular job, even if that job runs every minute and doesn't do anything. Store the information needed (like the permalink) somewhere and have the cronjob scan for jobs and process them.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users