bash.sh拒绝运行cron的权限 [英] Permission denied with bash.sh to run cron

查看:314
本文介绍了bash.sh拒绝运行cron的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在此处使用bash脚本运行cron.我在以下操作以及此处出现错误.我想知道如何在ubuntu中执行此操作.

bash.sh文件

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

在crontab -e

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

但是现在我得到以下错误

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

我该如何解决?我做错了什么?

解决方案

您也可以尝试以下解决方案:

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

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 ?

解决方案

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

这篇关于bash.sh拒绝运行cron的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆