It works for me too, meaning it starts the daemon. The real problems are that, once started, it won't do what it should and sooner or later die.
I don't have a printer that's compatible with the *LEXOPTRASC transform, so I can't actually test the printing. Instead, I changed your script to look like this:
#!/bin/sh if [ "x$1" = "xstart" ]; then echo -n ' prtas400'/usr/local/bin/lp5250d trace=/var/log/lp5250d.log env.DEVNAME=XXXXX env.IBMMFRTYPMDL='*LEXOPTRASC' env.IBMPPRSRC1='*A4' outputcommand='cat -> /tmp/test$$' as400
elif [ "x$1" = "xstop" ]; then echo -n ' prtas400' killall lp5250d else echo Please specify either 'start' or 'stop' fiWhen I run this, it works. The daemon doesn't get ended, I'm able to print data from the AS/400 without problems, each one appears in /tmp and they appear to have data from the printouts I sent to the printer, along with various printer control codes.
Not at all. It's 6.1p6/amd64. I simply copied another script. Maybe this is not as good with regards to style, but it works. Nothing's really wrong with it, is it?
No, it's fine.
Also, is there a reason to put all of the options into the script itselfAgain, no reason. I thought this way was easier, but I might be wrong. If it can change something, I will try it the other way.
It shouldn't matter.
Sigh!!! Problem is I don't administer this AS/400. In fact I know almost nothing on this architecture. Do you know of any straight howto which would lead me to check this out?
At an i5/OS command line, type the work with spooled files (WRKSPLF) command:
WRKSPLF SELECT(*ALL *ALL *ALL XXXXX)Replace XXXXX with the printer device name that you specified on the env.DEVNAME option to lp5250d. It should then show you any job logs for that printer. You can put the number 5 in the blank to the left of any of the spooled files to view it's contents.
Note that if you didn't know the correct arguments for the WRKSPLF command you could simply type:
WRKSPLFand then press F4 (instead of Enter) to see what the options are. you can also press F1 to read info about the WRKSPLF command. It's like having the man page built into the command... it's very handy.
I digress... The WRKSPLF command should show a bunch of spooled files that start with QPJOBLOG these are the ones that will tell you what happened when the printer session was active.
Would it suffice (or even help) if I asked the admin to delete this printer (which was created client-side running lp5250d) and start again?
This is unlikely, but if it'd be easy to try, then go ahead...
It need however some switch to prevent it from going into background. Then again this part of the problem might be the consequence of the other half...
Possibly. I think lp5250d will end if it gets an error when running the outputcommand. Is lpr in the PATH when lp5250d is started? Perhaps it can't find the command, and that's causing it to quit. You could change the outputcommand to '/usr/bin/lpr' to test that.
I could add a +nodaemon config option, that'd be a trivial change to the code. Then you'd have it in a future release...If it's not a problem, I think it would be useful. Right now I could modify the code by hand, as you suggested. This, in case I can get it to work, anyway.
I've added this option and committed it to CVS. For your convienience, I've also placed a tarball at the following location:
Running lp5250d in the foreground might help you understand what's wrong, since you'd see any messages that are written to stderr by your 'outputcommand'. ( lp5250d itself uses syslog() to report errors, but any utilities you list in the 'outputcommand' might be writing to stderr )
For example:/usr/local/bin/lp5250d +nodaemon trace=/var/log/lp5250d.log env.DEVNAME=XXXXX env.IBMMFRTYPMDL='*LEXOPTRASC' env.IBMPPRSRC1='*A4' outputcommand='lpr' as400
This'll run in the foreground. Then try printing to it from the AS/400 and see if you get any messages that could explain what's wrong.