Skip to content

Need help creating a script for cron job. Also another question inside....

edited May 2013 in Questions

So i've posted once before here needing help setting up a cron job and I didn't get much in terms of answers to the questions I had asked. I've tried contacting godaddy about setting up a cron job for sendy and I was told that I need to create a php file containing my command. I know absolutely nothing about script writing. I am now teaching myself the basics of HTML and CSS, so I am a bit away from learning proper script writing. I was hoping if there is somebody here who could walk me through the process of creating the file I need? Or even point me to a website that would help me learn?

I am not having much luck when it comes to searching for tutorial on writing a script for a cronjob. Any help is appreciated!

If needed the Cron job is: */5 * * * * php /var/chroot/home/content/05/10904605/html/sendy/scheduled.php > /dev/null 2>&1

Also I feel that this problem is related to myself not setting up a cron job, but I am unsure. I have been using sendy without a cron job and I noticed when sending out a campaign that sending will freeze at some random point. In order to finish sending out my campaign I have to select resume. But I've noticed that when I do such a thing it emails the mailing list more than once. For example I sent out a campaign last week to all subscribers (1300 emails) but was forced to resume. As a result sendy reports sending 2600 emails. The most recent campaign I had sent, I had received 2 emails of my campaign ( I am on the mailing list for testing purposes) after I had forced it to resume. Is this how the resume function works in sendy? By resending the whole campaign over? If not, how do I fix this? I dont want my subscribers to become annoyed with repeated emails and unsubscribe. Thanks ahead of time for any help.

Comments

  • Hi @osker246,

    There's no need to write any scripts.

    You just need to create a cron job in your GoDaddy control panel.

    But GoDaddy won't let you create a cron job that runs every 5 minutes on their shared server. You need to workaround this (see my last reply in this thread).

    I have been using sendy without a cron job and I noticed when sending out a campaign that sending will freeze at some random point

    Sending times out mainly due to server memory exhaustion. ​If you're using a shared hosting server, this will happen more often. Hosting companies usually place strict restrictions on shared servers like limited memory and CPU resources for the benefit of thousands of users sharing the same server (hence the name, shared hosting).

    If you setup a cron job for sending (recommended), Sendy can automatically resume sending when sending time out due to any reason so you don't have to babysit sending by clicking 'Resume' when it times out.

    If sending time out more frequently than you'd like, consider upgrading to your hosting company's VPS tier.

    Alternatively, use an Amazon EC2 server in which I provide installation services for. Sendy performs best on EC2 because SES servers are in the same location as EC2 servers, hence sending speed will be the most optimum. There are also no restrictions (like cron job interval restrictions) on EC2 servers as they're essentially VPS servers (not shared servers).

    Send me an email at (hello at sendy dot co) if you are interested.

    Thanks.

    Ben

  • Thanks for the reply ben. I am a little confused if I am not required a script to run the cron job because according to this it says I do:

    "Command
    The Command field is the script or executable that runs at a specified frequency. Click Browse to locate a file in your hosting account. The full file name of your selection is placed into this editable field. Click the question mark icon for additional assistance in selecting a command."

    http://support.godaddy.com/help/article/3548/working-with-cron-jobs?pc_split_value=2

    I simply tried pasting the cron job into the command field but it does nothing. It wont let me schedule a campaign. So im pretty sure I need a script or executable in order to get it running. I just dont know how to create one properly.

    Regarding my other issue though. If I get a cron job set up and I encounter a sending freeze. Does sendy pick up where it left off or does it resend the campaign again? Like I said earlier manually resuming for me caused multiple campaigns to be sent to myself.

  • Hi @osker246,

    I am a little confused if I am not required a script to run the cron job because according to this it says I do:
    Command The Command field is the script or executable that runs at a specified frequency.

    The script is Sendy's scheduled.php script. This is the script. You do not have to write any script.

    I simply tried pasting the cron job into the command field but it does nothing. It wont let me schedule a campaign. So im pretty sure I need a script or executable in order to get it running. I just dont know how to create one properly.

    Did you follow the workaround I mentioned earlier? GoDaddy shared server does not let you run a cron job every 5 minutes, so you need to use this workaround.

    Regarding my other issue though. If I get a cron job set up and I encounter a sending freeze. Does sendy pick up where it left off or does it resend the campaign again? Like I said earlier manually resuming for me caused multiple campaigns to be sent to myself.

    Yes if you setup a cron job correctly, Sendy will pick up where it left off automatically within 5 - 10 minutes. Manually clicking the "Resume" button is prone to "human error" so it's highly recommended to setup a cron job for sending.

    Thanks.

    Ben

  • edited May 2013

    I did create the workaround you posted in order to create a cron job that would run every 5 min. I understand that scheduled.php is ultimately the script we want the cron job to run. My problem arises from the fact that it seems as if godaddy is requiring a script containing the cron job command. I've already tried pasting my cron job command provided via sendy in the command field and nothing changes; I cannot schedule a campaign no matter how long I wait.

    This is godaddys cronjob manager:

    image

    This is the from the "help" of the command field:

    image

    I have yet to learn any of those languages in the second image. So im pretty much stuck using sendy without a cronjob for the time being. Am I interpreting what is required by godaddy cron job manager correctly? Thanks for your help Ben.

  • BenBen
    edited May 2013

    Hi @osker246,

    There is no need to use a script to setup your cron job. You can just use the interface.

    What I'm seeing right now is that your Command is entered incorrectly. Click the Browse button and navigate to your Sendy directory, then select scheduled.php. Then save.

    Remember to create 5 other cron jobs with the same command so there will be 6 in total as specified in this workaround for GoDaddy shared servers http://forum.sendy.co/discussion/177/run-cron-job-every-5-minutes-on-godaddy-shared-server/p1

    The minutes part will be different between the 6 cron jobs you will create, the first one will be 00-30, the second one will be 05-35, the third one will be 10-40, the fourth one will be 15-45, the fifth one will be 20-50 and the sixth one will be 25-55.

    Thanks.

    Ben

  • Well I do not know why I made that harder than it had to be. You absolutely correct I had to use the browser to point towards scheduled.php. This may makes much more sense now than what I originally thought had to happen. Sendy now allows me to schedule a campaign. But I am having a small issue with the campaign sending correctly. I believe this may be on godaddy's end though. Thanks for you help Ben!

  • You're welcome!

This discussion has been closed.