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

  • Home
  • SEARCH
  • 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 8092389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:24+00:00 2026-06-05T20:16:24+00:00

Some setup background first: I have a cronjob which runs a PHP file called

  • 0

Some setup background first:

  • I have a cronjob which runs a PHP file called worker_cronjob. All the file does is download my worker from git and the cronjob in cron.d looks like:

    */1 * * * * ubuntu /home/ubuntu/worker_cronjob >> /home/ubuntu/worker.log

  • It includes the worker_despatcher file

  • Which fires off a child process with (ROOT being an abolsute path to my directory):

    $PID = exec(sprintf(“%s > %s 2>&1 & echo $!”, “php “.ROOT.”/worker/encoder.php”.$arg_string, ROOT.”/worker/encoder.log”));

The problem is that under a cronjob this method is changing the way system commands are run, more specifically sh. So when I run a command like:

ffmpeg

It returns:

sh: 1: ffmpeg: command not found

After trail and error I have discovered this only happens from the cronjob, somehow it is changing the way directories are set, much like chrooting without me calling chroot.

I have looked at other threads and it says it use full paths when creating cronjobs and running files, however it’s not my files that’s the problem and they are all referenced via absolute paths, it is running installed programs where I get problems.

Does the absolute path apply to installed apps as well or is there a way to break this functionality to give me back the ability to just run a command with one word?

  • 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-05T20:16:25+00:00Added an answer on June 5, 2026 at 8:16 pm

    The behind reason is that cronjobs are run by the system, so they know nothing about your shell or user environment variables. You can say they run in a minimal environment.

    A great detailed answer can be found in Reasons why crontab does not work.

    Another way not shown in the above link resource is:

    * * * * * PATH=/usr/bin; command >> /var/log/command.log
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some setup code in my functions.php file that sets permalinks and adds
Some background first. I have a .net client agent installed on each of the
Some background: I setup six blogs this week, all using Wordpress 2.92, installed with
First Some Background I'm planning out the architecture for a new PHP web application
i currently have a Java Observer/Observable setup in which i switch on some field
I've setup some background colors for my Labels in order to position them. Now
Using Apache Wicket 1.4: I have a panel that calls some setup Javascript in
I originally setup some conditions using CGRectIntersectsRect for some collision detection which worked fine.
I am having some issues creating a setup file for my Outlook 2007 add-in.
First some background: VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web

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.