CentOS 7 Crontab with success

muploadrosal

New Member
YetiShare User
Aug 8, 2017
13
0
1
For other people with centos 7, with difficulty in running cron, i have done this way:

Add the cron lines to etc/crontab
Last line do a enter to enter a blank line
And in the lines i add the root user before path like the example bellow.

Code:
0 0 * * * root php /path/to/your/yetishare/admin/tasks/auto_prune.cron.php >> /dev/null 2>&1
0 0 * * * root php /path/to/your/yetishare/admin/tasks/create_internal_notifications.cron.php >> /dev/null 2>&1
0 * * * * root php /path/to/your/yetishare/admin/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
0 0 * * * root php /path/to/your/yetishare/admin/tasks/downgrade_accounts.cron.php >> /dev/null 2>&1
*/5 * * * * root php /path/to/your/yetishare/admin/tasks/process_file_queue.cron.php >> /dev/null 2>&1
0 1 * * * root php /path/to/your/yetishare/admin/tasks/create_email_notifications.cron.php >> /dev/null 2>&1
And you can check the logs in var/logs/cron

Best Regards
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
muploadrosal said:
enricodias4654 said:
You should not run those scripts using the root user.
Why not?


Best Regards
Because they will run with root permissions. A small mistake in the code when deleting a file could delete something important in your server and a security breach on those files can give someone root access yo your server.

Website scripts should never run using the root user.