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 755157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:05:50+00:00 2026-05-14T15:05:50+00:00

I have a cron job running a PHP script every five minutes; the PHP

  • 0

I have a cron job running a PHP script every five minutes; the PHP script executes two bash commands at the end of the script. I know the script is running due to a log file it appends to. When I run the PHP script manually via the Ubuntu Gnome Terminal both bash commands execute flawlessly; however when the PHP script is triggered via cron, the two bash commands are not ran. Any ideas?

$command = 'notify-send "' . count($infoleakPosts) . '  New Posts."';
`$command`;

$command = 'firefox http://example.com';
`$command`;

*/1 * * * * php /home/andrew/grab.php USERNAME PASSWORD # JOB_ID_1
  • 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-05-14T15:05:50+00:00Added an answer on May 14, 2026 at 3:05 pm

    Generally your cron scripts are going to be run under a different user account, and probably have a different environment path set up.

    Try setting your command lines to use the full path to the command, ie. /path/to/notify-send "x New Posts".

    You can use which notify-send from your regular terminal to get the path to put into your script.

    You can also grab the output from your command to help debugging. Use of the backtick operator will return the output, so you can assign it to a variable and/or dump it.

    $output = `$command`;
    error_log($output);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a cron job every five minutes which calls a php script
I have a CRON job php script that I just set up not too
If I have a cron job that run every 10 minutes and for some
I have a PHP page that I run every minute through a CRON job.
I have cron job - php script which is called one time in 5
I have one php script, and I am executing this script via cron every
I have two commands in a cron job like this: mysql -xxxxxx -pyyyyyyyyyyv -hlocalhost
I'm running a PHP script every night using a cron service. Everything it outputs
I have a php script that needs to run once every 5 minutes. Currently
I have one domain that is running a cron job every 15mins. I starts

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.