Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

#!/usr/bin tput clear tput cup 3 15 SSH='ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=n +o' SOURCE='/opt/ril_send/*' DEST='/opt/ril_receive' RUSER='idcadm' RPASS='redhat' tput setaf 3 echo "WELCOME TO THE WORLD OF AUTOMATION" tput sgr0 tput cup 5 17 # Set reverse video mode tput rev echo "M A I N - M E N U" tput sgr0 menu (){ tput cup 7 15 echo "[1] PINGING STATUS OF NODES" tput cup 8 15 echo "[2] COPY FOLDER TO LINUX NODES" tput cup 9 15 echo "[3] EXIT" } tput bold tput cup 10 15 echo -e "Enter your menu choice [1-3]:" function wait() { local msg1=$1 local msg2=$2 local msg3=$3 echo -e "\n\033[0m$1 $2 \t\t\t\t""[ \e[00;32m$3\e[00m ]" sleep 1 } #1.*******************PINGING STATUS********************************** +* PING_STATUS() { echo "ENTER SINGLE IP / IPLIST :" read ip if [ -n "$ip" ];then cat $ip 2> /dev/null 1> /dev/null if [ $? = 0 ];then ip="`cat $ip`" 2> /dev/null 1> /dev/null fi else echo "Please rerun" fi #externalprogram "$FILE" <other-parameters> echo -e "\t\t\t\033[0m\e[0;1;4;100;36mCHECKING SERVER ACCESSABILITY FO +R THE GIVEN IP LIST\e[00m" for IPS in $ip ;do fping $IPS 2> /dev/null 1> /dev/null if [ $? == 0 ];then wait "Pinging Server" "$IPS" "SUCCESSFULL" else wait "Pinging Server" "$IPS" "UNAVAILABLE" fi done echo -e "\n\033[0m\t\t\t\t\e[00;34;47m END OF THE SCRIPT \e[00m\n\n" } ###################################################################### +############################################# COPY_STATUS(){ echo "ENTER USER NAME:" read user echo "ENTER PASSWORD : " stty -echo read pass stty echo; echo "ENTER SINGLE IP /IP LIST : " read ip if [ -z "$ip" ] ; then echo "PLEASE RE-RUN"; else if [ -f "$ip" ] ; then ip1=`cat $ip`; else ip1=$ip; fi for ip in $ip1 do sshpass -p $pass $SSH $user@$ip "mkdir $DEST"; if [ $? -eq 0 ] ; then sshpass -p $pass scp -r $SOURCE $user@$ip:$DEST if [ $? -ne 0 ];then sshpass -p $pass rsync -avz $SOURCE $user@$ip:$DEST if [ $? -eq 0 ];then echo "copy succesfull" echo "copy successfull on $ip " >> copy_ok.txt else echo "copy faliure on $ip " echo "copy faliure on $ip" >> copy_err.txt fi fi else echo "copy successfull on $ip " echo "copy successfull on $ip " >> copy_ok.txt fi done fi } EXIT () { exit 0 } menu read input case $input in 1) PING_STATUS;; 2) COPY_STATUS;; 3) EXIT ;; esac

can u convert above mentioned shell script in to perl script??

In reply to sshpass perl by nik786

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-03-28 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found