Solved

Ruby - Rails - iSeries

Posted on 2014-11-12
3
250 Views
Last Modified: 2014-11-12
Is anyone using Ruby on Rails on the iSeries? I am attempting to start this up from a command line, instead of within QSH.   From within QSH, I run the following:

CD /tmp/sfdc_rc_trunk_nojruby              
thin start -e development -p 9292

This starts up a session but holds onto that session so you are stuck in QSH. If you end it and get out - Ruby is ended.

I was attempting to start this from a command line - but haven't had any luck. I created a shell script that said the following:

#!/usr/bin/sh                              
CD /tmp/sfdc_rc_trunk_nojruby              
thin start -e development -p 9292  

I put that in the same directory as above - and tried to start it up using one of the following 2 commands:

SBMJOB CMD(CALL PGM(QP2SHELL) PARM('/tmp/sfdc_rc_trunk_nojruby/startruby')) JOB(POWER_RUBY) JOBQ(*LIBL/QRUBY) USER(QSYSOPR)

SBMJOB CMD(QSH CMD('/tmp/sfdc_rc_trunk_nojruby/thin start -e development -p 9292')) JOB(POWER_RUBY) JOBQ(*LIBL/QRUBY) USER(QSYSOPR)

Both jobs "complete" right away and don't stay running and Ruby is not "started".

I also made sure that the authority was set to excute, so that shouldn't be a problem.

Any assistance would be appreciated.
0
Comment
Question by:Matthew Roessner
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 40437392
"thin start" starts a server - so what is happening when you start it interactively in QSH is correct and normal.  It really isn't something that you'd normally start interactively.

You can't run shell scripts reliably from QP2SHELL without doing some significant setup first, so I suggest you take that off the table for now.

So it looks like you can start the server from QSH interactively.  What happens when you start QSH interactively and enter the same command that you are submitting to batch?  Does it work without changing the directory first?

/tmp/sfdc_rc_trunk_nojruby/thin start -e development -p 9292

Assuming that doesn't work, next, test your startruby shell script interactively in QSH.  Does it work?  If so, then submit the shell script to batch using the QSH command, not QP2SHELL.

Unless your Ruby distro is specifically designed for QSH, you are probably better off running it in a PASE shell, so you may want to change your shebang line to to run in the PASE shell.  This means that even if you start from QSH, script gets executed in PASE - generally a good thing.

#!/QOpenSys/usr/bin/sh  

If you can get it to work from QSH interactive, then it should work OK from QSH batch, too.

- Gary

I
0
 
LVL 1

Author Closing Comment

by:Matthew Roessner
ID: 40437436
When I start QSH interactively (STRQSH) and enter the command I am submitting to batch:

/tmp/sfdc_rc_trunk_nojruby/startruby

Everything starts up fine (but I am "stuck" in QSH and if I exit - Ruby ends.

I did have to modify my startruby script to make sure was running from PASE:

#!/QOpenSys/usr/bin/sh            
cd /tmp/sfdc_rc_trunk_nojruby      
thin start -e development -p 9292  

Now when I start from a command line:

SBMJOB CMD(QSH CMD('/tmp/sfdc_rc_trunk_nojruby/startruby')) JOB(POWER_RUBY) JOBQ(*LIBL/QRUBY) USER(QSYSOPR)

Everything starts up correctly and all seems to be working as expected.  Looks like starting my script and running from the pase shell was the ticket.

Thanks for your help Gary!
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 40437519
Happy to help.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How do we balance the user experience (UX) with reasonable security measures? It can be done, if you keep these fundamentals in mind.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question