How do you want it to be better? Do you want to use less bandwidth? Do you want to start the script running and not have to keep a network connection open? Do you care if anyone else on the network can run the script? Do you care if people watching the network traffic are able to see something the script prints out? Are you tired of having to type in a password each time you run the script? Do you not like having to keep SSH keys on one of the machines for logging into the other?
Answers to the above questions indicate the mechanisms you should be using for running scripts on a remote machine.
I often use ssh with a password when I want to run the command manually.
For periodic cron jobs like backing up data I use ssh keys to keep the data encrypted and not require a login. (Just use
rsync with
--rsh=ssh.)
If I just wanted to grab the machine's load average and vital stats I would consider using a CGI because it doesn't require a login and I don't care if anyone sees the data.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.