Is there another way to run my php program in batch from the IBM i?


What I do is the following:

SBMJOB CMD(QSH CMD('chroot /QOpenSys/mwh001 /bin/bash -c
''/path/to/script.sh parm1 parm2'' '))


In script.sh I have the environment setup (i.e. PATH, set language version,
etc) and then invoke my actual program (i.e. Node.js, Ruby, etc).

Aaron Bartell
IBM i hosting, starting at $157/month. litmis.com/spaces


On Thu, Jan 5, 2017 at 2:17 PM, <MWHopkins@xxxxxxxxxxxxxxx> wrote:

Thanks everyone - I was able to SSH in and get everything configured and
working.

So now I am working on my ultimate goal which is to have a php cli script
run from the job scheduler at certain times of the day. I attempted to
create a shell script that will chroot into my jail, then call the php
script.

cat runAWS.sh
#! /bin/sh
chroot /QOpenSys/mwh001 /usr/bin/bsh
cd /home/mwh001/aws_php
php InstanceInterface_v2.php "$1" "$2"
exit

If I try to run this with a privileged profile from a 5250 command line.
[CALL PGM(QP2SHELL) ] I get a message that it is not found...

/QOpenSys/usr/bin/-sh: /QOpenSys/mwh001/home/mwh001/aws_php/runAWS.sh: not
found.

I get that error even when I go into PASE (QP2TERM) and call the shell
script from that command line.

I know the .sh script exists and is accessible from the profile, so I'm
not sure what it can't find. If I run each line interactively it works
like a charm...

-rwxrwxrwx 1 mwh001 0 120 Jan 5 14:28 runAWS.sh

Is there another way to run my php program in batch from the IBM i?

Matt Hopkins
EDI/Web Services Developer
Information Technology
--
Web: www.pdpgroupinc.com
Email: MWHopkins@xxxxxxxxxxxxxxx
Office: 410-584-0330
Cell: 410-258-8845
Support: EDISupport@xxxxxxxxxxxxxxx




From: Aaron Bartell <aaronbartell@xxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Date: 01/04/2017 02:57 PM
Subject: Re: [IBMiOSS] Attempting chroot
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxx>



I could write up some sample code to do that. Not sure where I'd put it,
though.


lots more stuff.....




--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/opensource.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.