Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8493287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:57:46+00:00 2026-06-10T22:57:46+00:00

I would like to execute a cronjob for a routine task every X hours.

  • 0

I would like to execute a cronjob for a routine task every X hours. The cronjob basically executes a shell script which in turn uses a WGET command to download files from a remote server. However, before I run this shell script I want the cronjob to execute a php script which will check whether the update’s available (there’s no point in wasting BW and downloading the same file over and over again) and if it is, it should pass on the update URL to the shell script which in turn uses the WGET command.

The cronjobs are set from the hosts Admin Panel. There is no other way around it. Being a shared hosting service, I am not allowed access to other functions on PHP which might do the task for me either.

Is this possible? I am Linux illiterate. I have installed a few RPM’s on Fedora but that’s about it. Please bear with me. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:57:47+00:00Added an answer on June 10, 2026 at 10:57 pm

    Just pass --timestamping to your wget command.

    Alternatively if you are more familiar with PHP’s ways you can check this question for a usable method.

    Use a curl HEAD request to get the file’s headers and parse out the Last-Modified: header.

    To use a php script as a regular command line executable use this as a starting point:

    #!/bin/env php
    <?php
    echo "Hello World\n";
    

    Save the file without the .php and tuck it somewhere that your server won’t serve it.

    Next, set the executable bit so that you can execute the script like a regular program
    (u+x in the following command means grant the [u]ser e[x]ecute privileges for helloworld, and chmod is the command that unix variants use to set file permissions)

    Omit the $ in the following sequence, as it represents the command prompt

    $ chmod u+x helloworld

    now you can execute your commandline script by calling it in the bash prompt:

    $ ls
    helloworld
    $ ./helloworld
    Hello World
    $
    

    From here you can get the full path of the executable script:

    $ readlink -f helloworld
    /home/SPI/helloworld
    

    And now you can install the cronjob using the path to your executable script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to execute a MySQL command in a shell script/cron job that
So I have a cronjob which executes a PHP script like so: 0 0
I would like to execute an Ajax request every seconds. My next code work
I would like to execute a PHP script from a C program and store
So I would like to execute an oracle plsql script from Visual Studio. I
I would like to execute a method which can only be called once my
I would like to execute a command via Django's manage.py shell function solely from
I have a javascript function that I would like to execute after every asynchronous
I would like to execute an OS command from my ruby script but I
I would like to execute some task after a user request in background. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.