Hi,
We are trying to add a cronjob to a domain after it's creating using domain_create_post.sh.
We've successfully been able to add a cronjob to the admin user but not to the domain.
Below is the code we are using.
domain_create_post.sh
add_owncloud_cronjob.php
Any idea as to what we might be doing wrong?
We are trying to add a cronjob to a domain after it's creating using domain_create_post.sh.
We've successfully been able to add a cronjob to the admin user but not to the domain.
Below is the code we are using.
domain_create_post.sh
Code:
php -f /opt/scripts/add_owncloud_cronjob.php ${username}
add_owncloud_cronjob.php
Code:
<?php
if ( ! isset($argv[1])) {
error_log('Username missing for cronjob creation');
die();
}
$user = $argv[1];
$admin_username = "admin";
$admin_pass = '**********';
include 'httpsocket.php';
$sock = new HTTPSocket;
$sock->connect('ssl://127.0.0.1', 2222);
$sock->set_login("$admin_username|$user", $admin_pass);
$sock->set_method('POST');
$sock->query('/CMD_API_CRON_JOBS', array(
'action' => 'create',
'minute' => "0",
'hour' => "*",
'dayofmonth' => "*",
'month' => "*",
'dayofweek' => "*",
'command' => "/usr/local/bin/php -f /home/$user/public_html/cron.php"
));
$result = $sock->fetch_parsed_body();
if (isset($result['details'])) {
echo $result['details'];
}
Any idea as to what we might be doing wrong?