Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ksh is available for linux and probably part of the packages available for your distro, once you install it you should be good to go.
2 things do come to mind:
- any solaris specific commands that might be used need to be "translated" to a linux version/equivalent.
- there are more then one ksh versions available (ksh93 and pdksh), do check which one you need.
I have pdksh.
For the migarion of scripts:I think i just need to copy and paste them to linux box.Am i right?
That's 'step 1'. After that, you try to RUN THEM on the Linux system, and correct error(s) as found. That's how you migrate ANY program from one platform to another.
And as druuna said, any Solaris specific commands in those scripts won't work, so you'll have to figure out what the Linux equivalent is. Also, some commands may return different output, even though the commands are the same. Again, you'll have to just step through the files one at a time, and adjust things as needed.
That's 'step 1'. After that, you try to RUN THEM on the Linux system, and correct error(s) as found. That's how you migrate ANY program from one platform to another.
And as druuna said, any Solaris specific commands in those scripts won't work, so you'll have to figure out what the Linux equivalent is. Also, some commands may return different output, even though the commands are the same. Again, you'll have to just step through the files one at a time, and adjust things as needed.
Also, I would scp or ftp them.
Copy/paste from the terminal can add hard newlines to lines that display wrapped in normal display.
I'd also recommend using the proper ksh, not pdksh.
Also, I would scp or ftp them.
Copy/paste from the terminal can add hard newlines to lines that display wrapped in normal display.
I'd also recommend using the proper ksh, not pdksh.
So instead of using cp command to migrate do u suggest me to use scp command.
How can we execute or run the ksh scripts.
So instead of using cp command to migrate do u suggest me to use scp command.
Well, did you read the man pages on those commands?? Since you can't just cp (copy) a file from one machine to another, you will obviously have to use some sort of network copy (like scp), to move the scripts over. You can also put them on a thumbdrive, CD, DVD, or move them however you want.
Quote:
How can we execute or run the ksh scripts.
The same way you're running them now, obviously. They're just scripts...execute them.
Yes, we know that, since that's how you opened this thread.
Quote:
I get this error when i run one of my scripts.Im using scp command to copy the script to the server.
ssh: connect to host SERVERNAME port 22: Connection refused
lost connection
pls help...
Spell out your words, please. And do you get the error when you're trying to scp the script from one system to another, or do you get it when you EXECUTE the script on the Linux system??? And are you really putting "SERVERNAME" in the command, or are you actually using a valid hostname/IP address? What is the exact command you're running?
Yes im using a valid hostname. Running the script with scp command on linux
Execution command:./filename.ksh
Im using scp command in this script to copy it from my home directory to the hostserver.
scp -p my/dir username@hostserver:dest/dir
Well, you're not specifying the path correctly, no matter WHAT *nix you're using. You need the leading "/", such as "scp -p /my/dir user@host:/dest/dir", so I'm not surprised it's failing. Also, you're trying to copy a DIRECTORY...you need to recurse it, so look at the "-r" flag. Again, this is common for ALL *nix systems.
Quote:
Originally Posted by prashanth1414
Code:
#!/bin/ksh
RC=0
errmsg="`basename $0` `date +%y-%m-%d-%H-%M` return cd: $RC"
OWNER=PEND
export SCRIPTS_DIR=`dirname $0`
STELLANT_DIR=/source/directory
STELLANT_PARSER=/dest/dir/filename
STELLANT_SERVER=servername
scp -p $STELLANT_DIR/filename.dat username@$STELLANT_SERVER:$STELLANT_PARSER
rc=$?
if [[ $rc != 0 ]]; then
addtoerrmsg=" failed."
print $addtoerrmsg
RC=8
errmsg="$errmsg $addtoerrmsg"
else
print "xxx.dat move to $STELLANT_SERVER:$STELLANT_PARSER successful."
fi
# Send page if errors.
if [[ $RC > 0 ]]; then
$SCRIPTS_DIR/error.ksh $OWNER $errmsg
print "paging"
fi
exit $RC
Ok, so you posted a script...but still haven't said if you're having problems copying this script to the Linux box, and if it's there, what error(s) you're getting, or how you're running it.
Basics:
Copy script from Solaris system to Linux system. Do this however you want...USB drive, SCP, FTP, NFS...doesn't matter. Copy them.
Make sure they're executable. Do an "ls -l", and set it to be executable with the "chmod 755" command at the least.
RUN the script with "/path/to/script.name", or "./script.name"
See if it works.
Again, if it DOESN'T, then open the script up. Look at EACH LINE, ONE AT A TIME. See if the command(s) are correct...run them in a terminal window, and see what they do/return, as compared to what it does on the Solaris box. Modify the commands as needed. This goes for variables too, like the directory names you posted above. Do they EXIST? If not, create them...make sure they're readable/writeable as necessary.
If you're having trouble with this, perhaps the administrator at your company can help you with the basics.
run command:./script.name
error: connect to host servername port 22: Connection refused
lost connection
scriptname.sh failed.
This is the error which i get when i copy my script from linux box to the Stellant server which i mentioned in the script.Im using scp to perform this task.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.