A
A
Angelxalfa2016-01-12 23:18:02
linux
Angelxalfa, 2016-01-12 23:18:02

How to set user for cron?

Good day!
Run php script with cron. But the script needs to delete the file from the folder during execution. When you run the script manually - everything is ok. When launched by cron - does not delete (probably lacks rights). Is it possible to set on behalf of which user to run cron, if not, how to find out which user it is running under in order to configure access rights to the folder.
I run it like this:
* * * * * /usr/bin/php /usr/local/www/db_request/misc/test.php
if I change it to root, for example, it doesn't work.
* * * * * root /usr/local/www/db_request/misc/test.php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-01-12
@Angelxalfa

The user can be set in the global cron /etc/crontab
* * * * * root /usr/bin/php /usr/local/www/db_request/misc/test.php
Or make your own cron for the system user via crontab -e

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question