Resolved File path for a cronjob

Status
Not open for further replies.

costas1

Member
Messages
134
Reaction score
3
Points
18
Which is the file path for a file that is under /domains/[domain1]/public_html?

I'm asking because I want to add a certain file of Mediawiki to a cronjob and run it once for installing an extension.

Thanks!
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
The full path for anything in that location would be:

/home/USERNAME/domains/[domain1]/public_html

Username would be the same as shown under "Quick FTP" (and is also seen at the right end of most content in filemanager as USER/USER
 

costas1

Member
Messages
134
Reaction score
3
Points
18
And the command before the path would be /usr/bin/php, right? Or is it at another path?
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
What I have in my account is: /usr/bin/php -q (the -q appears to be a needed part when I did some testing)
 

costas1

Member
Messages
134
Reaction score
3
Points
18
Should there be an output log in the public_html directory or not? I created three cronjobs, because I had to execute the file with different input parameters and new lines were not permitted, but I don't know if anything happened. I don't see any log.

I set the time of execution of each script 1-2 minutes after the creation of the cronjob, according to the time that was displayed in the cronjob creation page.
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
Note that a cronjob can only be done with a minimum of 5 minutes in between (this applies if you have more then one as well, make sure they do not collide at some point).

By default crons would only log error I believe, by sending a message to the message system in DA that is found in the upper right under your name.

You can specify that you want it to output to a log though, append this after the command: &>> /home/USER/PATH_TO/LOG.log

The log file can be put anywhere in your account, I'd suggest placing it outside of public_html to avoid it becoming publicly available.
 

costas1

Member
Messages
134
Reaction score
3
Points
18
I'm sorry for giving you a hard time, but as I don't get any log files, I don't think anything gets executed. Should I use the time I see in the cron jobs' page (which is my local time) or should I use the server's time?

That's my code:

/usr/bin/php -q /home/[username]/domains/[domain].org/public_html/maintenance/populateContentModel.php --wiki=wikiname --ns=all --table=revision &>> /home/[username]/domains/[domain].org/logs/revision.log
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
Cron will be executed on server time, which is eastern daylight time (EDT), servers are US located.
 

costas1

Member
Messages
134
Reaction score
3
Points
18
Cron will be executed on server time, which is eastern daylight time (EDT), servers are US located.

In that case if DirectAdmin can be customized, it should be better to display server time when creating a cron job because that's deceiving. I created a php script to print server's time at the start, but when I saw the clock, I deleted it and followed the time displayed by the clock.
 

costas1

Member
Messages
134
Reaction score
3
Points
18
OK, unfortunately nothing. Switched to EDT, left a gap greater than 5 minutes between the cronjobs. No log file. I will drop the -q flag and give it a last try as I fail to see any mistakes in my comands' syntax.
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
for hour you'd want to do military time, ie use a 24 hour clock, ranging from 0 (midnight) to 23 (11 pm)
 

costas1

Member
Messages
134
Reaction score
3
Points
18
Of course, no luck... I'm also checking certain tables in the wiki's database and that's further evidence that the script hasn't been executed, besides the log files that have never been created.
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
no you would set it to 16, assuming you want 4 pm
 

costas1

Member
Messages
134
Reaction score
3
Points
18
no you would set it to 16, assuming you want 4 pm

Indeed it is pm. I had am in my mind, that's why the misunderstanding. I saw the 0-24 in the Hour field's tooltip since the start. Sorry for the inonvenience. Let's hope that now everything goes fine.
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
On another note you don't have to specify all variables, for instance with having a date (day and month) you'd probably want to put * for day of week (or leave day and month as * and only have day of week to set it to a weekly event).
 

costas1

Member
Messages
134
Reaction score
3
Points
18
On another note you don't have to specify all variables, for instance with having a date (day and month) you'd probably want to put * for day of week (or leave day and month as * and only have day of week to set it to a weekly event).

I also saw a bug with the tooltip on the day of week, it says 0-7 7=sunday, it really should be 0-6, with 6 being sunday, that means a thursday is day 3

Is it really a bug? I had set it to 4 and the scripts executed, so I guess the only problem was the hour!

I had the -q flag when the script ran. I didn't try without it.
 

Anna

I am just me
Staff member
Messages
11,739
Reaction score
579
Points
113
Is it really a bug? I had set it to 4 and the scripts executed, so I guess the only problem was the hour!
Looks like I might have tired eyes, apparently both 0 and 7 counts as a Sunday in DA (though the normal is if there's a 0-7 range 6 and 7 counts as Sunday as far as I can tell)
 

costas1

Member
Messages
134
Reaction score
3
Points
18
Looks like I might have tired eyes, apparently both 0 and 7 counts as a Sunday in DA (though the normal is if there's a 0-7 range 6 and 7 counts as Sunday as far as I can tell)

In the end of the day everyones' thoughts get blurry. I guess it's natural after long hours. You can mark this thread as solved too, by the way.
 
Status
Not open for further replies.
Top