I have created a shell script which deletes subfolder of var/cache folder. Please check below script.
#!/bin/sh
now=$(date +"%Y-%m-%d %T")
if rm -rf var/cache/* ; then
echo "$now: Deleted"
else
echo "$now: problem"
fi
When I run this shell file directly by command sh hello.sh
it works fine.
But when I run this file using crontab it creates an entry in log file but doesn't delete subfolder of var/cache/..
Please check my crontab as well.
*/1 * * * * /bin/sh /www/html/wp/hello.sh >> /www/html/var/log/redis.flush.cron.log 2>&1
Please suggest how can I run that file using crontab.
sudo crontab -e -u root
– Rajan Sharmals -la
– Rajan Sharmavar/
– Nahuel Fouilleul