How add a cronjob under user apache

if you want to setup a cron job under different user or under apache, find out who is the owner of apache process

ps aux | grep apache

in my case the owner of apache process is “daemon”.
now create a cron job under “demon” user

crontab -u daemon -e

Now insert any cron job

* * * * *  cd /usr/local/apache/htdocs/website; /usr/local/bin/php webpage.php  > /dev/null 2>&1

Leave a Reply

Your email address will not be published. Required fields are marked *