Gossamer Forum
Home : General : Perl Programming :

Login and execute script on another box?

Quote Reply
Login and execute script on another box?
I am trying to write a Perl script that allows us to automate printer enable/disable and cancel jobs functionality. I have the code already done to get a status, ping and a job report on any printer.

I need some help with the code for an admin section as I'm still fairly new to Perl.

I have the login for the admin secure from some other code. I am unsure though how to write the code that would allow me to:

1) Login to remote Unix box

2) Run script with PRINTER name that is passed by user input.

3) Return information from remote box to host box on successful or not.


- Admin needs to kill a print job.

- Logs into the admin section of the code.

- Selects the printer (STL-001) and input the job (36589) to cancel.

- Login to the print server (remote machine) from the script.

- Issue the command to cancel the job (cancel STL-001-36589)

- Return and print the information from the remote machine command (SIL-001-36589: cancelled)

Can this be done? Any help or advice is greatly appreciated.

We are running Solaris 9 and using perl, version 5.005_03 (for Oracle Apps 11i)


Quote Reply
Re: [Kuberski] Login and execute script on another box? In reply to
I'm just wondering. Why use Perl to do this? 'C' would handle this a lot better, cos its designed to do the kinda thing you are attempting here Wink

Just wondering.


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Login and execute script on another box? In reply to
Don't know C....if anybody has pointers there it would be welcome too. My career path has taken me into the Oracle DBA world and Sun system admin. This task is something we are attempting to do to help take some admin responsibilities off our shoulders.
Quote Reply
Re: [Kuberski] Login and execute script on another box? In reply to
You could use the code I have written and posted several lines down from here "Perl SSH Expect Problem". The perl program uses Expect to SSH into two different servers to change passwords. I posted the code because I was having problems with SSH'ing into the server running the program. (SSH'ing to itself)Read the whole thread for how the problem was solved. But if you are going to SSH into a remote computer the code should help you on your way. (At least the remote login part.

New to Expect try this http://aspn.activestate.com/...c/Expect/Expect.html to answer any questions on Expect.

The URL to my code http://www.gossamer-threads.com/...ect_Problem_P247386/

The code is an attachment on my post.

Written for RH 9 you should be able to get it to work for you. What you need for login is in the sub change password in the SSH section for remote login. Then it would just be a matter of spawning the script you want to execute.

Hopefully this will help, Good Luck.
Quote Reply
Re: [tie571] Login and execute script on another box? In reply to
Thanks! I'll take a look at it and see.