Entries Tagged as 'BSD'

ncftp is just so beautiful when it comes to recursion

I happen to adore ncftp. When it comes to server to server transfers, there are a couple ways to approach this. One is to use a ftp client that supports fxp. I’ll go into this in more detail later.
Another way is to use one server, and access the other via a ftp transfer. Unfortunately, regular ftp doesn’t allow recursion into subdirectories and thus making it a nightmare to move files. Not really a problem at all. Just fire up the ole’ shell and use ncftp. ncftp actually allows you to enter username and password (anonymous ftp by default) and also has recursion built in.
When you’re in the directory that you need to grab, just do: get -r *
Then you can wait while this nifty ftp client just grabs everything for you. Saves the day many times over. And allows you time for that coffee that you usually don’t have time for.

Using .netrc for automated ftp

Sometimes there comes a need to actually automatically ftp things. But usually when you automatically ftp things, you have to enter in a password. The way around this is to use the .netrc file.
The .netrc file stores the machine name, the login, and the password for the ftp. This allows you to set up ftp actions without having to mess with the interactive parts and do everything else directly from a shell script.
Not exactly something that you’d want to always do for everything, but now and again behind a firewalled network, isn’t a bad idea for automated backups. Even if your passwords change constantly through a time seeded hardware device, you can set it up so that everything is still running from a shell script and the only thing you would have to do is type in the password. Beats doing things manually, eh?

Setting up no password ssh keys

One of the more interesting things that you can do with ssh is set up public and private keys and make it so that transactions between systems require no passwords. The bad thing about this is the obvious. If one of your systems inside get compromised, then your internal network is compromised without any work necessary.
The good thing though is that you can then set up automatic transfers through shell scripts or perl scripts. Either way, it’s definitely has its useful sides too. While this howto is for a Debian installation, it’s really no different at all when it comes to configurations.

Tracing hung processes through the ppid

One of the easiest ways to troubleshoot hung processes is trace it to the source. This works for cpu intensive things also, when dealing with a *nix based system. So if you look at the process ids, there are always a parent process id that’s associated with it.
It’s usually always in this format: So if you just trade those ppids as the pid, you can eventually find out what script or tool is dragging your entire system down. Basics of troubleshooting processes, but you’d be surprised how many people do not understand it.
If the process is eventually owned by root (or pid of 1) then it’s been zombied meaning the parent dropped out and tossed the reins to the root process. Zombie processes sometimes can actually never go away until they’re killed and just sit there taxing resources from your system.

How to create automatic ftp scripts in bash

You can do this in any operating system that allows you to do bash shell scripting, but if you know a little about shell scripting, then all you need to know is that you can do:
ftp -i << **
After you put this in the script, this will allow you to login and password to whatever is set in your .netrc. If you don’t have one, then you should set it before starting off a script like this.
All the commands after this line will be your usual ftp commands. When you’re done, then do a:
bye
**

Everything outside of this line will be back on your bash scripting syntax.

PhotoRec

photorec.jpg Ever have a hard drive go bad? Had many photographs or something where a corrupted memory card or disk is just not the answer you wanted to hear?
Hey, you might be in luck. PhotoRec to the rescue! PhotoRec is open source, and can be used with your major operating systems (DOS, Windows, linux, Solaris, MacOSX, BSD), and basically looks at corrupted file systems and copies over whatever is there onto a working system. It’s best for its namesake, but it recovers many other things by looking at the mediums’ filesystem.
But why take my word for it? Just take a look at Kent Brewster’s story.

OpenAntivirus

openantivirus.png OpenAntiVirus is an open source antivirus definitions project along with java based scanners. What’s interesting about this project is that this is one of the few open source initiatives for antivirus protection and does a pretty decent job at detection.
There are also third party developer scanners that are written to take the OAV virus detection files and it basically takes care of any sort of dilemma you may have without having to shell out for an expensive commercial antivirus product. To be frank, I personally like non-Java based scanners better, but it does allow for multi-platform almost immediately. That is a good thing.

free pascal: open source compiler for pascal and object pascal

freepascal.jpg It has literally been more than a decade since I’ve touched Pascal. Yet, it’s always going to play a nostalgic part in my life. This was the first more powerful language that I had played with since Basic and had written many a game and such with it. Gotta love the easy logic of Pascal.
What’s interesting is that free pascal is an open source 32bit and 64bit professional compiler. This means that it can compile on both types of architectures and support numerous platforms, from the Motorola 680×0 to your usual Windows, Mac, linux, bsd. It even supports some more non-standard platforms like DOS, and MorphOS. Crazy. The latest version even has support for Gameboy Advance and Nintendo DS.
Don’t have anymore of my old Turbo Pascal code anymore, but for those that are learning a language but don’t want the hassle of learning objects to start, procedural programming through Pascal isn’t a bad way to begin, even if the language is a bit dated in my opinion.

Abyss Web Server

abyss.png Buddy Lestat, recommended Abyss Web Server and who am I to judge his sanity? Actually, in all seriousness, Abyss Web Server is pretty sweet looking since it looks like a polished version of what Xitami had back in the late 90s.
You can download the Personal Edition for free which is multiplatform based (linux, macosx, Windows, freebsd), and the only things different between this and the pro version are some rules for bandwidth throttling and the ability to create virtual hosts (which the personal edition does not allow) and the usual technical support feature. The footprint is fairly small, with 1M for space and 4M for RAM constraints but it has the support for PHP, native ASP, ruby on Rails, and all sorts of fun stuff that you see in the more flushed out web server daemons.
Definitely worth taking a look if you need something that’s easy to manage and admin in a nice GUI format. Because these days, who doesn’t like to point and click?

nginx

nginx.gif nginx (pronounced engine x) is a http server and mail proxy server that is open sourced and extremely scalable. It’s used on many Russian sites, but one of the major success has been Fastmail.fm. nginx is written in such a way where it doesn’t use the usual one connection, one process method as most linux type server daemons run. Instead, it uses a polling feature, that allows the overhead to be extremely low. Thus, you’re able to maximize many more connections without having to use many resources (10,000 inactive HTTP keep-alive connections take about 2.5M memory).
So if you’re looking for a highly scalable web server or mail proxy server, nginx could be your key to decreasing your load and increasing your performance.