- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 10:24 PM
11-07-2004 10:24 PM
script problem
#!/bin/ksh
while read UNIX_Q NT_server NT_Q
do
for hostbox in $(cat /.netrc|grep root |awk '{print $2}')
do echo $hostbox
rexec $hostbox "usr/cbin/lpshut"
rexec $hostbox "/usr/sbin/lpadmin -p$UNIX_Q -v/dev/null -mrmodel -orm$NT_server -o
rp$NT_Q -ocmrcmodel -osmrsmodel -ob3"
rexec $hostbox "/usr/sbin/lpsched"
rexec $hostbox "/usr/bin/enable $UNIX_Q"
rexec $hostbox "/usr/sbin/accept $UNIX_Q"
done
done < printers.txt
It only runs once. If i comment out the rexec and add some echo's it works ok. The rexec is the problem.
Does anyone have any ideas how to resolve this?
- Tags:
- rexec
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 10:33 PM
11-07-2004 10:33 PM
Re: script problem
Check the follwoing entry in inetd.conf. If it is commented then uncomment it and rerun the inetd daemon.
exec stream tcp6 nowait root /usr/lbin/rexecd rexecd
Use "# /usr/sbin/inetd -c" to make inetd daemon reread the configuration file.
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 10:39 PM
11-07-2004 10:39 PM
Re: script problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 10:53 PM
11-07-2004 10:53 PM
Re: script problem
Did u configured .rhosts or /etc/hosts.equiv file properly.
See Man .rhosts and hosts.equiv.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 11:08 PM
11-07-2004 11:08 PM
Re: script problem
man netrc for details. set it up and it should work. Also use you rexec as follows for clarity and ease of management.
rexec "host" -l "user_name" -n "command" Also your second rexec will not work, because, there is no way on lpadmin on remote host to know what is UNIX_Q. What you will have to do is somehow put details about UNIX_Q into a file on remote hots and use it from there.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 11:15 PM
11-07-2004 11:15 PM
Re: script problem
RAC is right, rexec uses .netrc for user authentication and remsh uses rhosts or host.equiv file....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 11:23 PM
11-07-2004 11:23 PM
Re: script problem
The script works - lp, etc all works. the problem is that rexec will only run the for loop once.
comment the rexec and it all works fine.
So rexec must send an exit signal for the for loop???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 11:27 PM
11-07-2004 11:27 PM
Re: script problem
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2012 07:29 PM
01-15-2012 07:29 PM
Re: script problem (rexec/remsh in loop)
>the problem is that rexec will only run the for loop once.
As mentioned in the fine print of RAC's reply, you need to use -n, otherwise rexec/remsh/ssh, will eat up the stdin that is driving the for-loop or while loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2012 07:22 AM
01-16-2012 07:22 AM
Re: script problem
You need to trace the script's actions since you didn't supply any messages that come from the script. After the the first line, add the line:
set -x
Now each step of the script will be shown and you can see what each step is doing.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2012 08:03 AM
01-18-2012 08:03 AM
Re: script problem
Your problem seems an "exit" gived by "rexec" directly on the ksh process
You should try to replace every line of rexec with this:
rc=`rexec etc etc.. `
In this way "rexec" will be executed by another process
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2012 05:54 PM
01-18-2012 05:54 PM
Re: script problem (rexec/remsh in loop)
>You need to trace the script's actions since you didn't supply any messages that come from the script. ...
>Your problem seems an "exit" given by "rexec" directly on the ksh process ...
You guys didn't believe me when I said the problem was with missing -n? ;-)
That's the whole reason I replied to this old thread, nobody explicitly mention why -n would fix it.