cron job

Web hosting discussion, programming, and shared and dedicated servers.
12 posts Page 1 of 2
by Praveen » Wed Jun 05, 2013 10:14 pm
How to set a cron job on sonic.net server ?
by Greytrix » Wed Jun 05, 2013 10:27 pm
Use putty to setup cron tab

login with username and password

type crontab -e in shell command to open the crontab file

eg:
type in crontab file to setup a cron job to run at every 10 minutes

if you are running a PHP script
*/10 * * * * http://yourdomainname.com/subdirectory/cronjob.php
or
If you are running a Shell Script
*/10 * * * * http://yourdomainname.com/subdirectory/cronjob.sh

if your domain path do not work type the file path for the root directory and then the path of your cronjob file
*/10 * * * * /xyz/nfs/abc//subdirectory/cronjob.php

and then save the file by typing shift+: and then wq

Check the cronjob list by below command
crontab -l

remove all the cronjob by below command
crontab -r

for PHP script to run as a cronjob put the below shell command at the beginning of the PHP file
#!/usr/bin/php

Hope that will work for you!
by Guest » Wed Jun 12, 2013 2:20 am
You might also find it useful to visit http://www.dataphyx.com/cronsandbox/. Put in different date/time parameters and get a list of job run times.
by bodegalt » Sun Aug 09, 2015 10:54 am
Greytrix wrote: and then save the file by typing shift+: and then wq
but it didn't work. Any other way to save the cron job?
by goetsch » Sun Aug 09, 2015 1:28 pm
Depends on what your editor is. In vi, you need to type [Escape] before [Shift]+: wq
by bodegalt » Sun Aug 09, 2015 7:29 pm
We'll I'm using putty and when i did the crontab -e, it didnt asked for an editor to use. So I really have no idea which editor im using. Sorry, Noob here.
by bodegalt » Sun Aug 09, 2015 7:31 pm
goetsch wrote:Depends on what your editor is. In vi, you need to type [Escape] before [Shift]+: wq
BTW, I did try this out and it didnt work.. I also tried doing the one for Nano and that didnt work as well. Thanks for replying.
by bodegalt » Sun Aug 09, 2015 10:01 pm
I found this on the editor:
Joe's Own Editor v2.9.7 <- WTH is THAT?!?!

Using my googlefu, I found out that this editor follows the old ^KS commands that the old Wordstar used. Anyway, thanks guys for the help and a really bad job SONIC on the technical support side. As if it wasnt hard enough that the people we talk to on the phone for technical support doesnt know anything, you had to use a non-standard editor. Nano or Vi would have been better.
by joemuller » Wed Aug 12, 2015 2:37 pm
If you just put a URL in your crontab, it's not going to work - you're just going to get a lot of error messages. I recommend pre-pending the URL with wget or curl like so: (http://stackoverflow.com/questions/11375260/)

Code: Select all

curl http://example.com/test.php
I'm a proud employee of Sonic.net! :-)
by fhawks » Fri Aug 21, 2015 3:56 pm
Thanks to the help in this thread I set up a crontab file.

Using the path only (e.g. /home/WWW_pages/username/mysite.com/etcetc/cron.php), I was sent an email saying "permission denied."

Running curl http://www.mysite.com/etcetc/cron.php from the shell prompt seems to work, so I put that into the crontab instead, and it works!
12 posts Page 1 of 2

Who is online

In total there are 45 users online :: 0 registered, 0 hidden and 45 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 45 guests