I've been trying to get cron to execute these two scripts to schedule and post on twitter, tumblr, facebook and linkedin. It worked once and never again.


require '/opt/bitnami/apps/wordpress/htdocs/wp-load.php';




$parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content',               


require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' );

//now try calling template function



What can I do?

  • Too broad?? It doesn't get much simpler than a cron job guys! Maybe you should move to Windows instead and go clickety click.
    – captcha
    Nov 13, 2014 at 21:36
  • It's too broad because he's asking us to debug his script. Your answer isn't applicable to what the OP is actually asking.
    – Bratchley
    Nov 13, 2014 at 21:40
  • His question is 'can you set up a cronjob for me'. That I helped him with. Without seeing his cron job entry it could very well be that he just made an error in his cron entry. Also, there is no dialogue to help the question-asker to be more informative. Clearly he's a newcomer. Is that how we should treat those new to the world of Linux and Unix??
    – captcha
    Nov 13, 2014 at 21:46
  • 2
    Is he being polite by asking us to do something for him rather than just help him do something? The title asks how to set up a cronjob but if you read the actual body he's saying "It worked once and then stopped. Can you tell why?" So he's not asking how to set up a cronjob, he's asking for help writing a script to run as a cronjob. He doesn't even bother giving his full code, what he's tried, or what could have changed recently. I see "wp-" up there so apparently WordPress enters the picture somewhere but I don't know how. At this point I can't even be sure this isn't trolling.
    – Bratchley
    Nov 13, 2014 at 21:52
  • 2
    But it's just put on hold anyways. If it's edited later on, it can be re-opened. It's not like he was punished for asking a question, he was just told to revise his question.
    – Bratchley
    Nov 13, 2014 at 21:55

1 Answer 1


Assuming that your scripts are correct, put

#!/usr/bin/php -q

..as the first line in your script (the next line will be your <?php tag), chmod the script executable, then add

0 * * * * /path/to/your/php/script.php

to your crontab to run it once every hour.

Not the answer you're looking for? Browse other questions tagged or ask your own question.