使用Cron的Shell脚本可以';不要执行shell命令

使用Cron的Shell脚本可以';不要执行shell命令,cron,openshift,Cron,Openshift,我正在尝试用cron重新启动服务器。我找到了这个链接: 但是不起作用。这是我的剧本: #!/bin/bash source /usr/bin/rhcsh ctl_all restart 这就是输出: /usr/bin/rhcsh: line 7: source: filename argument required source: usage: source filename [arguments] /usr/bin/rhcsh: line 32: build_path: command n

我正在尝试用cron重新启动服务器。我找到了这个链接:

但是不起作用。这是我的剧本:

#!/bin/bash
source /usr/bin/rhcsh
ctl_all restart
这就是输出:

/usr/bin/rhcsh: line 7: source: filename argument required
source: usage: source filename [arguments]
/usr/bin/rhcsh: line 32: build_path: command not found
/usr/bin/rhcsh: line 33: build_ld_library_path: No such file or directory
    *********************************************************************
    You are accessing a service that is for use only by authorized users.
    If you do not have authorization, discontinue use at once.
    Any use of the services is subject to the applicable terms of the
    agreement which can be found at:
    https://www.openshift.com/legal
    *********************************************************************
    Welcome to OpenShift shell
    This shell will assist you in managing OpenShift applications.
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with "rhc app delete"
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Type "help" for more info.
Command "quota" not found for app xxxxx, please check the node hosting this app
WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
Restarting services
/usr/bin/rhcsh: line 123: gear: No such file or directory
有什么想法吗

非常感谢

编辑:

这是rhcsh脚本(该脚本有300行,因此我已上载到服务器):

试试这个:

#!/bin/bash
gear restart --all-cartridges    # same as: ctl_all restart

ctl\u all
/usr/bin/gear
脚本的包装函数。

您的/usr/bin/rhcsh文件似乎有问题。你能粘贴它的内容吗?嗨,Tomasz,问题是cron安装在OpenShift()基础设施上,不能修改脚本。如果你仍然想看到脚本,可以将其添加到主帖子中。仍然可能会有帮助。问题可能不在于脚本本身,而在于它所利用的某些东西,可能是某些环境变量。我特别好奇第7行发生第一个错误的地方是什么。我同意Tomasz的观点,有脚本会很有帮助。我已经添加了一个文件链接。