Cron for website
-
- Forum Regular
- Posts: 196
- Joined: Tue May 10, 2005 1:24 pm
Cron for website
I have a Plesk 10 server and I have a user that needs to run some php cron scripts that login to their mysql db and make some changes each night. I tried to allow them a chrooted environment, but php and mysql are not available in that environment. I was able to get php running and all the libraries loaded, by copying what was need for them, but I can't get php to load the mysql library. Does anyone know if this is the best way to do this? Is there a better, safer way to allow this? If this is the best way, how do I load mysql with php in this chrooted environment?
Re: Cron for website
I thought Plesk did cron jobs for them under their FTP user
"Its not a mac. I run linux... I'm actually cool." - scott
-
- Forum Regular
- Posts: 196
- Joined: Tue May 10, 2005 1:24 pm
Re: Cron for website
It is run under their ftp user. But that has no access to php. It seems like the cron jobs run chrooted. Is that not right? I enter a job with the command "php -q /path/to/file" and I get "php: command not found" or "/usr/bin/php -q /path/to/file" and I get "/usr/bin/php: No such file or directory".
-
- Forum Regular
- Posts: 196
- Joined: Tue May 10, 2005 1:24 pm
Re: Cron for website
I do know that I can set the ssh setting under Web Hosting Settings to /bin/bash and it will work, but is that a good idea? If I set that to forbidden (which I normally do), it seems to be chrooted when it runs.
Re: Cron for website
So you're testing this with the CLI? And there's two /bin/bash, one is chrooted (at least in mine there is)
"Its not a mac. I run linux... I'm actually cool." - scott
Re: Cron for website
Personally I simply do a wget via http.
e.g.:
And I seem to recall that wget has options that allow you to specify username/password credentials, so you can place the file you want to run in a proteted directory so that it doesn't get accidentally run or accessed by anyone.
e.g.:
Code: Select all
wget -q -O /dev/null http://www.whatever.tld/directory/file.php
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
-
- Forum Regular
- Posts: 196
- Joined: Tue May 10, 2005 1:24 pm
Re: Cron for website
highland - Yes, there are two. If I set it to /bin/bash, the cron job runs fine, but I really don't want to give this user that access to the system. If I set it to /bin/bash (chrooted), I run into the original problem that php is unknown. So that is when I started copying files to to that web users directory so they would have access to php in their chrooted environment. I got all the libraries needed to run php, I just can't get php to use the mysql library. If I could get that part working, I would be set.
faris - Great idea. I might just settle on this idea as it will cause the least amount of configuration changes to get the same result.
faris - Great idea. I might just settle on this idea as it will cause the least amount of configuration changes to get the same result.