Bug 917294

Summary: Can't call "ctl_app" from a cron job. Getting "command not found"
Product: OKD Reporter: Nam Duong <nduong>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: jofernan, wsun
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-04 16:49:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nam Duong 2013-03-02 18:49:29 UTC
Description of problem:
See https://openshift.redhat.com/community/forums/express/restart-jboss-with-cron

I was able to reproduce this by creating an app, adding cron, and a minutely job called foo.sh with:  
ctl_app restart  

In the cron log, I see:  
/var/lib/openshift/513245f25004468bb7000051/app-root/runtime/repo//.openshift/cron/minutely/foo.sh: line 1: ctl_app: command not found

Comment 1 Wei Sun 2013-03-04 06:35:35 UTC
Check this bug on INT(devenv_2886)

Step:
1.create an app,and add cron-1.4
2.add a minutely job called foo.sh with ctl_app restart

Result:

foo.sh: line 2: ctl_app: command not found

Additional info:
run ctl_app restart in my app,can not get above error message.
[cht-wsun3int.int.rhcloud.com cron]\> ctl_app restart
[cht-wsun3int.int.rhcloud.com cron]\>

Comment 2 Jhon Honce 2013-03-04 16:49:35 UTC
In you foo.sh script, add the line 'source /usr/bin/rhcsh' before using 'ctl_app'.