[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1160
  • Last Modified:

Plesk Cron Job - Error

Hi guys,

I'm trying to use a Cron Job through Plesk to execute a PHP script on my server. The job is set to run every 60 seconds, and send me an email when it does.

That part seems to be working correctly, and I am receiving an email every 60 second. However, the email contains the following:

"user with id=10263 and name=shareafi not found in chrooted passwd file
system error: No such file or directory"

Here's the argument that i'm using:

/usr/bin/wget  --timeout=0 "http://www.shareafile.co.uk/Code/clean_up.php "

I've tried various different arguments, but I get the same result each time.

Any thoughts?
0
gesmuk
Asked:
gesmuk
  • 4
  • 4
1 Solution
 
Robert SaylorSenior DeveloperCommented:
Your user might not have access to wget. You might need to add wget to your sudo with the UID.

IE: visudo

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
yourusername ALL=NOPASSWD: /bin/wget

Then call it /usr/bin/sudo /bin/wget in your cron.
0
 
gesmukAuthor Commented:
I'm embarressingly going to sound like a real noob here and ask, where do I run this?

I'm not massively familiar with Unix. Do I run this from within Plesk somewhere?
0
 
Robert SaylorSenior DeveloperCommented:
You will need to use SSH. Download putty. Note: Plesk uses a sudo envirement unlike WHM/cPanel. You will have to ssh in as "admin" then su - as root. It's 2 different passwords on Plesk.
0
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
Ray PaseurCommented:
Scripts that test out correctly as web pages may not work the same way when started as CRON jobs.  The PHP and SQL environments are usually different.  It's always something of a research project to discern the differences, and this is how I usually start.

1. Run this script, shown here in its entirety as a web page and print the output document.
<?php phpinfo();

Open in new window

2. Install this script as the CRON job and wait long enough for it to be triggered.  You should receive an email message.
<?php
ob_start();
phpinfo();
$msg = ob_get_clean();
mail('You@Your.Org', 'CRON Info', $msg);

Open in new window

3. Compare the phpinfo() data from the web page and the CRON.  Plan on this taking a while; most likely the information you need is near the bottom of the rather large jumble of output.  Adjust the CRON PHP script variables as needed to make the PHP script work.  You will probably find dependencies on things like DOCUMENT_ROOT and the paths to the SQL servers.
0
 
Robert SaylorSenior DeveloperCommented:
If you are not familiar with SSH I would ask your dedicated server hosting company to make the change to visudo. It is a 5 second job and most would not charge for small modifications. Once your cron job executing as the "plesk" user has permission to the command "wget" it should operate with no issues.

From my experience with plesk this is the issue.
0
 
gesmukAuthor Commented:
Thanks guys,

Seeing as this seemed to be account related, I logged into Plesk under a different account and set up the Scheduled Task again.

This time, I'm getting a different error message on the email

" PHP: command not found"

After a bit of googling, it seems as though it's another command that I have to run through SSH to resolve this...?

However, it does appear as though I don't have access to SSH on the server
0
 
Robert SaylorSenior DeveloperCommented:
Do you have root access? If you own the dedicated server you should. The default SSH port of 22 might not be the SSH port. You would want to open a ticket with your dedicated server provider for instructions to SSH into your server. If you are on a shared plan or a reseller plan you won't have this access and you would need to request your host for assistance. Note: Your host won't allow this on a shared server. This is usually a dedicated server option.

Note: Check out WHM/cPanel. It is much better then Plesk and the license fee's is about the same amount.
0
 
gesmukAuthor Commented:
Thanks guys, a support ticket raised with the host managed to get it resolved. Though unfortunately I don't know what the fix actually was :(
0
 
gesmukAuthor Commented:
Support fixed issue
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now