Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied with bash.sh to run cron

How to run a cron with bash script here.What i did as follows and here with errors.I want to know how to do that in ubuntu.I was struck with it now

bash.sh file

#!/bin/bash
cd /var/www/Controller
/usr/bin/php post.php

In crontab -e

* * * * * /home/samitha/bash.sh >> /home/samitha/log/cron.log 2>&1

But now i getting following error

/bin/sh: 1: /home/samitha/bash.sh: Permission denied

How will i fix it ? what i did wrong ?

like image 347
underscore Avatar asked Feb 08 '14 13:02

underscore


1 Answers

you can try the following solution as well:

chmod +x post.php
chmod +x bash.sh
echo "* * * * * /home/samitha/bash.sh >> /home/samitha/log/cron.log 2>&1" >> cronjob

chmod +x cronjob

/etc/init.d/crond start  #redhat based servers like centos
/etc/init.d/cron  start  #debian based servers like ubuntu

crontab cronjob
like image 63
MLSC Avatar answered Oct 09 '22 20:10

MLSC