Unix
Dealing with OS X resource forks in samba
by Jett on Dec.09, 2010, under Apple, Computers, Servers, Technology, Unix
Figured I’d put up a quick post. I’ve been growing more and more annoyed with OS X creating resource forks to some of my mapped samba drives, and after searching high and low for a method of disabling resource fork creation on network drives, I’ve effectively come up empty handed.
Now, that being said, I did come up with a way of dealing with resource fork creation – while its not exactly elegant, it works. It just so happens that all my servers are unix based, so to deal with resource fork cleanup, I just added a cronjob to my crontab. This will delete all of OS X’s resource fork files in a specific folder (and subfolders).
0 */1 * * * find /var/www/ -name ‘._*’ -print0 | xargs -t0 rm > /dev/null 2>&1
Note, if you’re going to use this, change the path (/var/www/) to whatever path you want to cleanup.
Also – I take no responsibility for this, make sure you have your data backed up, and all that jazz before you use it.
Ubuntu 8.04 iSCSI shutdown
by Jett on Nov.17, 2009, under Computers, Miscellaneous, Servers, Unix
Just a quick post today – I ran into the same issue many many other people seem to have, that being connecting to an iSCSI target in Ubuntu 8.04 means you cannot cleanly shut-down your system as it will hang during the shutdown process. I’ve been doing a little bit of research as to why (because obviously this is very bad), and it seems as though whoever wrote the particular version of Open-ISCSI (2.0.865-1ubuntu3.3) decided it would be a good idea to shut down the iSCSI service before unmounting the disks.
So, I figured out a quick workaround – simply change the shutdown order, such that Open-ISCSI is shut down after the filesystems have been unmounted.
cd /etc/rc0.d
sudo mv K25open-iscsi S80open-iscsi
Your rc0.d folder should look something like this:
lrwxrwxrwx 1 root root 17 2009-11-12 10:27 K20sysstat -> ../init.d/sysstat
lrwxrwxrwx 1 root root 20 2009-11-12 09:28 K25hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx 1 root root 26 2009-11-12 09:28 K59mountoverflowtmp -> ../init.d/mountoverflowtmp
-rw-r–r– 1 root root 355 2009-01-23 10:01 README
lrwxrwxrwx 1 root root 22 2009-11-12 09:29 S15wpa-ifupdown -> ../init.d/wpa-ifupdown
lrwxrwxrwx 1 root root 18 2009-11-12 09:28 S20sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root 17 2009-11-12 09:28 S30urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 22 2009-11-12 09:28 S31umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx 1 root root 18 2009-11-12 09:28 S40umountfs -> ../init.d/umountfs
lrwxrwxrwx 1 root root 20 2009-11-12 09:28 S60umountroot -> ../init.d/umountroot
lrwxrwxrwx 1 root root 20 2009-11-12 10:28 S80open-iscsi -> ../init.d/open-iscsi
lrwxrwxrwx 1 root root 14 2009-11-12 09:28 S90halt -> ../init.d/halt
Then, next time you reboot, it should unmount the disks and then stop open-iscsi.
PHP Mail() Abuse
by Jett on Aug.05, 2009, under Servers, Unix
Recently came up against a bit of a tough nut to crack, so to speak, and thought I’d write up a quick blog about how I fixed it, in case anyone else has this problem. At MRX, we have several different hosting environments we use, one of which is a shared environment for our smaller clients. The problem being that one of those clients had a vulnerability on their site that was allowing spammers to send unauthorized e-mail through our servers, thereby getting us onto a whole bunch of blacklists.
After a bit of searching around, it seems as though its actually possible to completely disable the mail() function from PHP, however, that was only a temporary solution. This is simply a matter of adding
disable_functions "mail"
to the php.ini file and reloading the apache configs.
While I searched for an actual solution to the problem, I came up with the idea of attempting to use a php_admin_value flag value to disable e-mail for a specific virtual host inside the htaccess files until I was able to determine which was the offending site. Again – brick wall – PHP doesn’t support setting disable_functions in the php_admin_value flag.
So, after a bit of searching, I decided to just add the following to each site’s .htaccess files:
php_admin_value sendmail_path "/dev/null"
Essentially sending all e-mail to /dev/null for that particular site. Perhaps not the most elegant solution, but it was effective, as we are no longer sending e-mail through a broken form and I was able to alert the affected client that they had a problem.
Sun buys MySQL, Oracle buys Sun…
by Jett on Apr.22, 2009, under Computers, Servers, Unix
So, big news of the week, Oracle just bought Sun Microsystems for some ridiculous amount of money ($7.4 billion in cash). Aside from the obvious moanings of how I wish I had $7.4 billion in cash just sitting around so I can buy up companies like playing monopoly, this deal has me (and likely a number of other people) wondering about the future of MySQL now that its going to be owned by Oracle.
I’ve been reading up on the topic a lot, and it seems as though no one’s really talking about whats going to happen with Sun’s newest acquisition. I can’t say I’m not just a little concerned, since all of our work here at MRX is powered by MySQL databases. Thats not to say I’m afriad of Oracle, just its both expensive (as in not free) and complex. I’d argue, so complex that not many people out there who know Oracle are looking for work.
One interesting point I did find when reading up on the topic that I didn’t really know, is that Oracle does own a number of other database systems including TimesTen, Berkeley DB open source, as well as InnoDB. However, none of these directly competes with Oracle, whereas MySQL does. So, the question is, do they monitize MySQL to a lesser degree than Oracle (while maintaining some form of stripped down free version), do they drop MySQL alltogether and provide some form of migration path to Oracle 11g, or do they simply let both co-exist and continue monitizing Oracle.
If I had to guess, I’d say they will likely monitize MySQL to a lesser degree than Oracle, probably in the form of support contracts mostly, and still continue to provide a free open source version of MySQL. Obviously they would charge for any new features they decide to add to MySQL along the way. Probably very similar to Redhat Enterprise’s business model – seems to be successful for them.
Ubuntu Jaunty Jackalope
by Jett on Apr.21, 2009, under Computers, Servers, Unix
So, I just upgraded to Ubuntu Jaunty on two of my VMs here at the office. I know its not set to come out in a final release for a few days, however, we’re in the process of migrating to a fully virtualized system, and unfortunately Intrepid has some issues with iSCSI connections. Namely if you try and shut down the machine, it’ll hang because it tries to disconnect the drive before its unmounted and then just throws errors.
Anyway, as per usual, the upgrades went more or less flawlessly – minus a few symbolic links that needed to be re-created. Since I don’t have GUIs on these machines (waste of resources on servers if you ask me), a quick:
sudo apt-get update
sudo apt-get install update-manager-core
sudo do-release-upgrade -d
And about half an hour later and I was all upgraded. No more iSCSI disconnection problems, and one new feature I’ve found that actually changed my whole workflow when it comes to servers. That being the inclusion of screen-profiles, a sort of profile manager for screen allowing you to create default screens that open when you log in, as well as status bars, clocks and notifiers. If you haven’t heard of it, I’d highly recommend you check it out.
Converting Raid-1 to Raid-5
by Jett on Jul.25, 2008, under Computers, Servers, Unix
So, I happened across this article today, written by a Scott Wallace, I’ve copied the text here in case his site goes down for whatever reason. Note, I haven’t tried this as of yet, but in the future when I fill up my drives, I’ll likely be able to just buy another 500 gig drive and convert my raid-1 array to a raid-5 array instead of having to buy another 3 whole drives.
Converting RAID1 to RAID5 with no data loss | scott.wallace.sh
Enable/Disable Ubuntu Remote Desktop from the Command Line
by Jett on Jul.23, 2008, under Computers, Servers, Unix
Further to my previous postings about Ubuntu and VNC, which seems to have been the most popular page on my blog for a while, I happened across this post from Sam Lesher this morning on how to enable Ubuntu’s built-in remote desktop from the command line. The built-in remote desktop uses VNC, and so kind of eliminates the need for any form of VNC Server setup.
Sam Lesher » Ubuntu 7.04 – Enable/Disable Remote Desktop from the Command Line
To enable remote desktop from the command line, issue this command:
$ gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled trueTo disable remote desktop from the command line, issue this command:
$ gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled false
Unfortunately, this only works if you have previously configured remote desktop with a password, which would in theory require physical access to the machine. That being said though, I want to set it up remotely, and so to add to Sam’s guide, I’d like to add that you can X-Forward a gnome session through SSH which will allow you to change this option. I’m working on a how-to which I will post shortly.
New projects
by Jett on Oct.17, 2007, under Personal, Site Updates, Unix
So, I’ve been insanely busy the last few weeks, and haven’t taken any time out of my busy schedule to write anything of interest here. I’ve been really busy with work and life, but I won’t bore you with the details of that…
I will however, take a few seconds to introduce a project I’ve decided to work on (as if I wasn’t busy enough already). As you know, I play WoW fairly regularly (World of Warcraft for those un-educated). There are many resources for the game, and a LOT of addons amongst various sites. Keeping your addons up-to-date unfortunately can be quite the chore, and so some wonderful people over at WoWAce (www.wowace.com), have written a small program to search through their site and find updated addons. Unfortunately, they wrote it in .Net, which obviously doesn’t help us Mac users out there. In comes the Java WoWUpdater: http://sourceforge.net/projects/javawowupdater a small project I’ve taken on, to port the WoWAce Updater to Java allowing it to be truly cross-platform.
I’ll keep you all posted on my progress, but for now there isn’t much to show or tell. If anyone’s interested in helping me out on this project, and knows anything about UI design or Swing, I’d be most appreciative of the help.
Well thats it for now, have fun everyone!
J.
MySQL qCache goodness
by Jett on Sep.18, 2007, under Servers, Unix
I have to start off by apologizing, I had intended on posting this last week, but got tied up with a lot of work stuff. Our Windows server decided to throw a hissy fit, and I really hate windows. Somehow the permissions got all messed up and IIS wouldn’t read any of the web files, we spent almost three full days trying to get the permissions set back up. Finally we just gave up and decided to back up the system and re-install it.
Anyway, continuing on the theme of system optimizations, I thought I’d talk a little bit about a simple optimization you can make to MySQL, that will greatly increase your server performance. In comes MySQL’s Query Cache or qCache for short. Its already built into MySQL, all you need to do is enable it. “But caching data is bad” or, “My boss says we update our data too much to make it worth caching”. Both of these ideals are in fact wrong. I used to hold to the one that said that caching data is bad, yes, it generally is a bad idea if done improperly, but if done properly it’ll save you a lot of time.
APC Saves the day
by Jett on Sep.11, 2007, under Servers, Unix
And no, thats not APC as in American Power Conversion, thats APC as in Alternative PHP Cache. At the office, we host a fair number of high traffic websites, sites that routinely push a few gigs of traffic a day each. Obviously, thats a lot of web traffic, and we do have to keep our servers running fairly well. We also have a few, what we refer to as “seasonal” sites, where traffic for the sites spikes during certain parts of the year.