PDA

View Full Version : Fix for UNIX sort or rm commands?



jhalbrook
08-31-2003, 09:19 AM
I've noticed that the UNIX sort and rm commands are no longer supported under the WH 2.0 VPS, and are no longer available to Perl scripts. Does anyone know of a workaround?

FZ
09-05-2003, 06:01 PM
rm works for me, but sort --help:


sh: sort: command not found

smither
09-05-2003, 06:25 PM
If you still have access to an uncoverted domain, copy the sort command and put it in your WH2 domain. I put mine in /usr/local/bin and it seems to work.

wildjokerdesign
09-05-2003, 06:31 PM
I am still able to get to my old sites even though they have been converted through FTP by using my old IP number and username and password. Maybe that would help some folks that have been converted to get to their old files and stuff.

FZ
09-05-2003, 09:23 PM
Great idea Shawn... Simply brilliant!

I tried to upload "sort" from my 1.0 account to your anonymous FTP, jhalbrook, so you could use it, but your FTP looks broken... I can mail it if you like, or if you can get access to your old account like WJD said, just FTP it to your 2.0 account (put it in /usr/local/bin and CHMOD +x sort). Already FTP'd SCP to Avery...

ajparker
09-05-2003, 09:27 PM
Thanks again for the scp....

Avery

jhalbrook
09-06-2003, 07:01 AM
I tried the whereis command, but cannot find the sort command on my old server. Looks like most of the subds are protected. I can see the contents of /usr/local/bin, but sort is not there. Where did you find sort at on your old server?

wildjokerdesign
09-06-2003, 07:19 AM
Ok I am going to step forward and look stupid again.... :oops:

I am familar with FTP and use WS_FTP to work with my site. I do know that you can also get to your site using... putty ? ssh ? .... that is called teleneting to your account.. am I right? I have done that but was pretty confused on how to acomplish things using that method so backed off.

My question is. Would I have more controll using that method instead of FTP. As a rule I try to keep thing pretty simple on my sites but I am seeing that perhaps I may need to learn some new ways of doing things in order to "keep up". I think more then anything I was afraid of telenet and that I may be more apt to "break" something. :) It looks like the new Site Manager gives control over stuff that would have been done with telenet in the past.

As you can tell I am one of those folks who are more compfortable with a program that gives me buttons and menues to use. That said when I first started I learned how to create pages doing my own html codeing as opposed to using a wysiwyg editor. I was glad I learned that since although I know use Dreamweaver It lets me find problems and customize things that a program like that can create or force on you.

Think I should take the step and know of any books or sites that would not make me run screaming from the room?

ajparker
09-06-2003, 10:15 AM
SSh is called telnetting into the site in the Westhost manual as I recall.... actually telnet was an older protocol - data (including login/password info) was sent plain text across the internet. Somewhere along the line it was decided that was a bad idea and they developed ssh a protocol that offers end to end encryption based (if I recall correctly) in part on an identification key that exists on each machine (there may be another random component - it seems like each session has a slightly different encryption code.

SSH is more powerful than telnet though because it allows for port forwarding (connect a specific port on a remote machine to a local machine (so the traffic is encrypted.)) It also includes sftp which is a secure ftp protocol (I'm not sure if WS_ftp has support for sftp? Anyone out there know?) sftp behaves exactly like ftp except for the fact that there is end to end encryption (less likelyhood that someone can eavesdrop and pick up your username/password.) It seems like the westhost 1.0 sites didn't support sftp - but 2.0 seems to.

scp is also a part of the ssh package. I use it mostly when I want to move just one or two files to a location.... The syntax for my scp command might be a little different from putty (running linux here....) but I can do $scp filename domainname@domainname.com:/home/domainname/
to send filename to my home directory on the webserver. I've found that much quicker than ftp when I'm just moving one file... of course, I guess you could do the same for a directory $scp * (*.* under windows I guess) domainname@domainname.com:/home/domainname/www/

For that matter if you had a specific set of files that you frequently copied, you could probably make a desktop shortcut for the lot of them...

I use scp many times for just migrating files to and from the webserver (kind of as a remote filestore) and the computers that I work with...

Have you run screaming from the room yet? :D

You might take a look at http://winscp.sourceforge.net/eng/ for a GUI of scp/sftp (I seem to remember that ws_ftp supports sftp these days too.) It seems like putty gives command line utilities only for scp and sftp.

Since ssh keeps track of the keys of the sites you connect to, that was one of my first tip-offs that some of my sites had moved (there was a new host key for the remote machine...)

That may be more than you EVER wanted to know..... :wink:

Avery

wildjokerdesign
09-06-2003, 10:40 AM
Avery,
Yes I must say the urge to run screaming is there but I think I will fight it and keep digging in.... may take me a week or two.... Thanks or you reply I will check out sourcforge.

FZ
09-06-2003, 11:01 AM
Just out of interest for those that want to get 1.0 programs onto 2.0, here's how you would do it:


1. SSH Log in to your 1.0 account

2. Type:

cp /bin/programname $HOME
Where programname is the name of the program you want to copy (e.g. scp or sort). If it says it can't find it, try /usr/bin/programname instead.

3. Now that you have it in your $HOME directory, you can either e-mail it to yourself and then upload it into your 2.0 /usr/local/bin or FTP from the SSH command prompt and upload it there yourself. Don't forget to

CHMOD +x programname
once you are done.

If you can't access a 1.0 account or you need any help, please post your question here and one of the many helpful users on this forum well help you out ;)

FZ
09-06-2003, 11:12 AM
Shawn,

If I had to explain SSH in layman's terms, I'd say it is a "program" which lets you "control" the computer you are connected to (the WestHost server) just as if you were physically sitting in front of it yourself. It is immensly powerful - much more so than an FTP program, and in some cases it is easier and more user-friendly to use because it provides you with so much more detail about files, etc. and you can access text manuals through it as well. Now I know this is a bit cliched to say, but the WestHost manual does a good basic intro on it: http://manual.westhost.com/part1.html#gi-telnet They even link to Putty (which is the program you should get) and explain how to set it up. However, there are some things that you must use the Site Manager for that you cannot do with SSH (not easily though, anyway).

Yes, it is easier to "break" something using SSH, but only if you are being careless, which I doubt you will be when experimenting/learning. You could always set up a few test files in a "test" directory and mess around with those to make sure you don't do something wrong that effects your normal files. Just a few examples of what you can do with Putty: download files to your WestHost account (utilizing WestHost's extremely fast connection), you can do that for files you want to zip and download yourself from your WestHost account to increase speed, or for programs you want to install on your account yourself (e.g. Imagemagick). You can read your mail (plain text) using Pine. You can use Pico (an easy to use text-editor) to make quick changes to files you want to edit (or create new files from scratch). Almost anything you can do on your own computer, you can do on your WestHost server/account using SSH (just no fancy GUI). The possibilities are endless - I've only touched on some of the most basic and most useful stuff. I'm sure I've even missed out on some other useful stuff in my example. Oh well...

You can calm down and come back into the room now ;)

wildjokerdesign
09-06-2003, 11:30 AM
Thanks design64 yours and ajparker's post have gotten my breathing back to normal... :) . The adventure begins!

trinity.westhost.com
09-06-2003, 11:56 AM
Sort is missing and was an important part of many of my CGI scripts. I needed ot install GNU Developer Tools to get some my other CGI scripts working in 2.0. So...

If you're so inclined, install GNU Developer Tools (will cost you some disk usage, apparently -- still a sort point if you read my other post) and then download GNU Core Utilities from: http://www.gnu.org/software/coreutils/

Run the ./configure script. Compile everything by calling make on the command line. Copy the src/sort command somewhere else, and then delete everything else.

bruce.binder
10-07-2003, 05:01 PM
I built and installed the GNU textutils package, which includes sort. The tricky part is that the "configure" script actually needs the sort command. Sort of a chicken and egg problem. The easiest thing to do is write a simple one in Perl and put it somewhere in your path. Make sure it is called "sort" and is executable. The file I used looks like
<pre>
#!/bin/perl
while(&lt;>) {
@INPUT = (@INPUT, $_);
}
(@OUTPUT) = sort (@INPUT);
foreach (@OUTPUT) {
print $_;
}
</pre>
Then the normal steps for building and installing worked fine.

Download the GNU textutils package from gnu.org or one of the mirror sites. The file is
textutils-2.1.tar.gz

Unzip it
gzip -d textutils-2.1.tar.gz

Un-tar it
tar -xvf textutils-2.1.tar

It will create a directory full of the source, Makefiles, etc. and instructions for
building in a file called INSTALL. The synopsis is

cd textutils-2.1

Run the configure script
./configure

Make the binaries
make

Install the binaries in /usr/local/bin
make install