If you fancy a game of online chess, why don’t you subscribe (for free!) to GameKnot.com and challange me for a game of chess!
Follow the above link (click on the image) to sign up and I’ll meet you online!
If you fancy a game of online chess, why don’t you subscribe (for free!) to GameKnot.com and challange me for a game of chess!
Follow the above link (click on the image) to sign up and I’ll meet you online!
This is a nice trick I use to get my /home/Public of my NAS at home directly as a mounted volume on my MacOS X desktop.
You need to install three applications / frameworks:
1. MacFuse
2. Macfusion
3. sshfs (to update the old version pre-installed with Macfusion)
1. Install MacFuse
Download and install MacFuse.
MacFuse comes with a nice preference pane to check for updates. The version was 2.0.3 (or 2.1.5 beta) as of this writing.
2. Install Macfusion
Macfusion is an open source SSHFS mounting application for OSX (Snow) Leopard. Download and install.
If you’re using Snow Leopard, you’ll find that the current version of MacFusion refuses to complete a connection to a remote server. You can fix this in three steps:
1. First, quit MacFusion.
2. Second, open System Preferences and then open the MacFUSE pane. Check the “Show Beta Versions” box and click “Check For Updates”. Go ahead and update MacFUSE to version 2.1.5 beta as of this writing.
3. Third, open up a terminal and do the following:
rm /Applications/Macfusion.app/Contents/PlugIns/
sshfs.mfplugin/Contents/Resources/sshnodelay.so
Your MacFusion installation should now be working on Snow Leopard.
Add an SSHFS file system
To add an SSHFS file system click on the plus icon at the bottom of the main window and choose SSHFS.
Adding an SSHFS filesystem
Set SSHFS mount parameters
Under the SSH tab:
Host: The hostname of the server that you SSH to. This is usually the domain name of you website ( e.g. ‘yourdomain.com’ ).
User Name: Your SSH username.
Password: Your SSH password.
Path: can be left blank, default path will be used
Under the SSH Advanced tab:
Port: The default SSH port is 22 unless your server uses a different one ( just try 22 ).
Follow Symbolic Links: Leave this checked.
Under the Macfusion tab:
Mount Point: can be left blank.
Volume Name: can be left blank, but to nice up the icon on your desktop, use any name
Ignore Apple Double Files: You must uncheck this if you plan to open/edit/save files on the mounted volume. For example, if you want to edit an image file using Photoshop, this setting has to be unchecked. However, this powerful feature comes with a downside. Leaving this unchecked will cause OSX to place .DS_Store and ._ * ( Appledouble ) files on the server. OSX utilizes these hidden files for enhanced filesystem features and extended file attributes in non OSX native filesystems. For example, a Photoshop file can have icon, thumbnail, and version cue information saved in a separate Appledouble file. These files are invisible in OSX and other filesystems as they start with a dot. Leave this checked if you are just going to copy/move/delete files ( increases speed ). You can leave this checked if editing text files as most apps don’t save additional file attributes with text files. However, this depends on the application you use, so do some testing first.
Enable Negative VNode Cache: This is an optimization to increase speed and should generally be left checked unless files can appear on the mounted volume from the server side. For example, if multiple users are using your mounted disk space leave this unchecked.
You will now have an SSHFS filesystem ready to mount on your desktop.
Mount the remote filesystem
Click on the mount button and if the SSH settings are correct, you should have a green disk icon mounted on the desktop.
You can now access your remote files like they were on an external disk attached to your computer. You can copy, move, rename and delete files at ease. Remember that if you want to edit files on the remotely mounted disk, the Ignore Apple Double Files checkbox should be unchecked. You can easily edit the SSHFS mount settings by unmounting the disk and clicking on the Edit button.
You might have noticed that we completed only two of the three steps but you can already mount your remote filesystem. This is because Macfusion already has SSHFS pre-installed within its application package. However, I found the mounted filesystem response to be a little sluggish and wondered if the version of SSHFS that came pre-installed with Macfusion was outdated.
3. Update SSHFS
Let’s examine the pre-installed version of SSHFS that comes with Macfusion. RIGHT-CLICK ( or CONTROL-CLICK) on the Macfusion app in the Applications folder. You will be presented with a contextual menu. Choose the “Show Package Contents†menu option. You will then be presented with a folder containing the application folder hierarchy. Drill down until you see an application called sshfs-static.
Macfusion application hierarchy showing the location of the pre-installed version of SSHFS
This is the copy of sshfs that Macfusion uses to do its magic. To check its version, I opened up the Terminal app, changed directory to the parent folder off sshfs-static and typed in ./sshfs-static -V . You don’t have to do this by-the-way, just skip to the Download and Install SSHFS section.
% cd /Applications/Macfusion.app/Contents/PlugIns/
sshfs.mfplugin/Contents/Resources/
% ls -la
total 5736
drwxr-xr-x 9 chandima staff 306 Aug 4 2008 .
drwxr-xr-x 5 chandima staff 170 Aug 4 2008 ..
-rwxr-xr-x 1 chandima staff 46928 Aug 4 2008 new_sshfs_askpass
-rwxr-xr-x 1 chandima staff 2756952 Aug 4 2008 sshfs-static
-rw-r–r– 1 chandima staff 13259 Aug 4 2008 sshfs.png
-rw-r–r– 1 chandima staff 6796 Aug 4 2008 sshfsAdvanced.nib
-rw-r–r– 1 chandima staff 7609 Aug 4 2008 sshfsConfiguration.nib
-rw-r–r– 1 chandima staff 61418 Aug 4 2008 sshfs_icon.icns
-rwxr-xr-x 1 chandima staff 29280 Aug 4 2008 sshnodelay.so
% ./sshfs-static -V
SSHFS version 1.8 (MacFUSE SSHFS 1.3.0)
MacFUSE library version: FUSE 2.7.3 / MacFUSE 2.0.3
no mount point
The pre-installed version was 1.8. I wondered if I’d get a speed increase if SSHFS was updated to the latest version which was 2.2 (as of this writing).
Download SSHFS from:
http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS (make sure you download sshfs-static-leopard.gz ).
After you uncompress the gzip archive, you will end up with a folder called sshfs-binaries. In there, you will see an app called sshfs-static-leopard.
Rename sshfs-static-leopard app to sshfs-static to match the filename that Macfusion expects.
Replace the old version of sshfs with the new version:
Drag and drop the downloaded and renamed sshfs-static executable into the Resources folder to replace the older version within the Macfusion package hierarchy.
You can check the version again to make sure that the new version is recognized.
% ./sshfs-static -V
SHFS version 2.2 (MacFUSE SSHFS 2.2.0)
MacFUSE library version: FUSE 2.7.3 / MacFUSE 2.0.3
no mount point
I unmounted and remounted the filesystem and the speed increase was quite significant. I highly recommend that you do this third step.
That’s it! Now you can access your remote SSH folders as a local volume.
I needed a simple script that would copy the entire folder structure of certain users (under Linux) to a backup destination. This is how I did it.
You would need a file call users.txt with the names of the users, divided by linebreaks.
users.txt:
user1
user2
user3
And this little script:
createfolders.sh:
#!/bin/sh
dest='/backup'
cat users.txt | while read user;
do
base="/users/$user"
find $base -type d -print | cpio -pvdum $dest
done
First off, I have tried and tried again over the years to boot various PowerPC Macs via a USB2 disk. Thankfully, somewhere about the time the iMac G5 with the ambient light sensor (ALS) was released, Apple tweaked their Open Firmware, which allowed us to boot PowerPC Macs from USB2 drives.
Machines that I have tested this hint on and made it work are:
iMac G5 w/ ALS
iMac G5 w/iSight
12″ PowerBook 1.3GHz
Without further delay, here’s the process to follow.
Note: As with all hints that have to do with Open Firmware, proceed at your own risk! I have not experienced a problem and I don’t see how this hint could render your Mac useless, since the default can always be recovered by resetting the SMU.
Here’s what you need to do…
You need a USB2 drive with an OS X system installed (I am using 10.4.3, though any I think will work as far as what the machine can boot). As you know, there are many different ways of getting a system on a USB drive; contact me if you have any questions on how to do that, or search macosxhints.com for that information.
Connect the drive to your machine, and find out which partition the OS X system is installed on. I usually find this by going to Disk Utility and looking at the info for the partition on the USB disk with OS X. That is, disk2s3 is usually for a USB disk with no OS 9 drivers installed that is the second disk disk. disk3s9 might be a USB disk with OS 9 drivers that is considered the third disk. There are other ways of finding this out, but in my case, my disk is disk2s3 (the 3 on the end will come into play soon).
Start up the machine in Open Firmware (this is the fun part). Hold Command-Option-F-F right after the machine is turned on.
Here is the moment of truth. If this step does not work, I have had very limited success getting a machine to boot off USB2. In Open Firmware, type devalias, and you should get a list as output. In this list, look for ud, usually below where you see hd (ud is “USB Disk,” I presume). If found, it will usually have beside it /pci@f2000000/usb@1/disk1, or something similar. Again, if you see this, I have not had this fail yet.
Now type printenv boot-device, which will usually get you output of boot-device hd:,\\:tbxi. (See where this is going yet?)
Type setenv boot-device ud:3,\\:tbxi where the number after the colon corresponds to that partition number we found in step two. You should get an ok back.
Type printenv boot-device, and you should see the change displayed already. Something like:
boot-device ud:3,\\:tbxi hd:,\\:tbxi”
Type mac-boot and cross your fingers.
If this fails, there is a remote possibility that you can still boot off of USB2, but you may need to substitute ud for /pci@f2000000/usb@1/disk1, or something similar. If the firmware cannot list the contents of the drive, it seems it cannot boot off of it.
As you should know (thanks to the owner of the iMac G5 w/iSight for letting me know I should mention this), USB2 booting is not supported, therefore you should remember OS X has no support for booting USB 2 and the firmware has no support. So in System Preferences, the USB disk will not be shown as a bootable drive. In the optional boot menu (reached by holding down the Option key during boot), it also will not show.
feed=http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/
ipk_name=$(wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}')
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/" > /opt/etc/ipkg/armel-feed.conf
wget http://mybookworld.wikidot.com/local--files/optware/sort_dirname.tar.gz
tar xvfz sort_dirname.tar.gz -C /
export PATH=$PATH:/opt/bin:.
ipkg update
ipkg install gcc
ANd the next eTRAYZ mod: MRTG.
1. Install net-snmp
ipkg install net-snmp
2. Install mrtg
ipkg install mrtg
3. Change config snmpd.conf in /opt/etc/snmpd.conf to reflect these changes:
# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid]
rocommunity public
# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
# arguments: community [default|hostname|network/bits] [oid]
#rwcommunity SNMPv1_RW
4. Restart snmpd daemon with
/opt/etc/init.d/S70net-snmp restart
5. Make mrtg folder with
mkdir /opt/etc/mrtg
6. Create mrtg profile for localhost with
cfgmaker public@localhost >> /opt/etc/mrtg/mrtg.cfg
7. Make mrtg WorkDir with
mkdir /home/sysadmin/WWW/mrtg
8. Reflect this folder as WorkDir in
vi /opt/etc/mrtg/mrtg.conf
9. Make HTML file with
indexmaker --output=/home/sysadmin/WWW/mrtg/index.html /opt/etc/mrtg/mrtg.cfg
10. Make crontab entry with crontab -e and add
*/5 * * * * root cd /opt/bin/ && ./mrtg /opt/etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
11. Restart cron with
crond restart
12. To be sure, reset permissions:
chown -R sysadmin:etrayz /home/sysadmin/WWW/mrtg/
13. Browse to http://etrayz/mrtg/index.html and enjoy.
I want to monitor the network usage on my eTRAYZ. So I installed vnstat and a php frontend.
Here’s a guide.
1. Install vnstat using ipkg.
ipkg update
ipkg install vnstat
2. Create vnstat database.
vnstat -u -i eth0
3. Change to the web folder and download the PHP frontend
cd /home/sysadmin/WWW
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.tar.gz
4. Expand the archive, delete it and rename the folder
tar xvzf vnstat_php_frontend-1.4.tar.gz
rm vnstat_php_frontend-1.4.tar.gz
mv vnstat_php_frontend-1.4 vnstat
5. Change to the new directory and edit config.php using command
cd vnstat
vi config.php
and change the variable $iface_list so that the line reads
$iface_list = array('eth0');
6. Delete these two lines:
$iface_title['eth1'] = 'Internet';
$iface_title['sixxs'] = 'SixXS IPv6';
If you want you can change the friendly name for $iface_title[‘eth0’]. Do not change the definition of variable $vnstat_bin, this must be left blank because the php script that calls vnstat uses a “\” which is not allowed by the php service in safe mode. Safe and quit vi.
7. Consequently we have to set up a cronjob to dump the vnstat data in to the “dumps” directory defined in variable $data_dir. Make the directory dumps:
mkdir dumps
8. Now we need to make a script and cronjob to update the nvstat data and create the dumpfile. Make a folder for your scripts
mkdir /home/sysadmin/my_scripts
9. Create a script file for cronjob to run
vi /home/sysadmin/my_scripts/vnstatdump.sh
…and paste the following lines into it
#!/bin/bash
/opt/bin/vnstat -u
sleep 10
/opt/bin/vnstat --dumpdb -i eth0 >> /home/sysadmin/WWW/vnstat/dumps/vnstat_dump_eth0
10. Make the script executable by doing:
chmod +x /home/sysadmin/my_scripts/vnstatdump.sh
and test the script by running it
sh /home/sysadmin/my_scripts/vnstatdump.shvnstatdump.sh
There shouldn’t be any error messages.
11. Create the cronjob schedule
vi /etc/crontab
… and enter new lines for however frequently you want the web page data to be updated. For instance to have it updated every hour at 1 minute past the hour enter a line like
1 * * * * root /home/sysadmin/my_scripts/vnstatdump.sh
12. Restart crond, i.e. “crond restart”
Use your internet browser and open the index.php page: http://etrayz/vnstat/index.php. Done.
Update: changed version beta 5 to RC3
A little how-to for installing SABnzbd 0.5 on your Xtreamer eTRAYZ. I’m not explaining how to SSH to your box ecc, you should all know that before doing this. Newzbin is working well in version 0.5 on my eTRAYz.
Follow the guide on mavvy.net to install version 0.4.x on your box, to get the base system running. Try this before using this guide to update SABnzbd to version 0.5 RC3.
1. SSH to your box and goto the /opt/share folder.
2. Get the source from the SABnzbd site:
wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus-beta/0.5.0RC3/SABnzbd-0.5.0RC3-src.tar.gz?use_mirror=mesh
3. Expand the folder
tar zxvf SABnzbd-0.5.0RC3-src.tar.gz
4. Stop SABnzbd, rename the existing SABnzbd folder to oldSABnzbd and the 0.5 version to SABnzbd
/etc/init.d/sabnzbd stop
mv SABnzbd oldSABnzbd
mv SABnzbd-0.5.0Beta5-src.tar.gz SABnzbd
5. Reset owner
chown -R sysadmin:etrayz SABnzbd
6. Install support system
ipkg update
ipkg install py25-cheetah
7. Copy the SABnzbd.sh file from the old folder to the new one and edit it with VI
cp /opt/share/oldSABnzbd/SABnzbd.sh /opt/share/SABnzbd/
vi /opt/share/SABnzbd/SABnzbd.sh
8. This is the main trick to get 0.5 working! Edit the start commando as follows:
nice -n 20 python2.5 /opt/share/SABnzbd/SABnzbd.py -s $IP:8888 &
I’ve added the nice -n option to give more importance to other processes on the box and, more importantly, forced SABnzbd to use python 2.5, otherwise the Cheetah module won’t work. Test this by starting python and python2.5 for the command line and by typing:
import Cheetah
Version 2.4 or 2.6 will return this error:
[1:~]$ python
Python 2.6.4 (r264:75706, Nov 11 2009, 00:14:30)
>>> import Cheetah
Traceback (most recent call last):
File "
ImportError: No module named Cheetah
While version 2.5 returns:
[2:~]$ python2.5
Python 2.5.4 (r254:67916, Jun 1 2009, 22:35:31)
[GCC 3.4.3 (release) (CodeSourcery ARM Q1B 2005)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cheetah
>>>
… nothing! Therefor it works and so will SABnzbd 0.5!
If you use the iphone interface in 0.4, please rename this to Mobile in your sabnzbd.ini.
This is the script I use on my Mac Mini Server to remotely backup the store directory on another server using rsync.
#!/bin/sh
if [ `id -u` != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
username=root
ip=192.168.0.7
dest=/opt/kerio/mailserver/store
folder=/usr/local/kerio/mailserver/store/
if [ $1 = "dry" ]; then
echo "Dry run activated. Simulating copy.";
dry=-n
fi;
if [ $1 = "log" ]; then
echo "Logging activated, directing output to /usr/local/kerio/log";
echo `date` >>/usr/local/kerio/log;
echo " " >>/usr/local/kerio/log;
options='-rumzh -v'
else
options='-rumzh -v --progress'
fi;
echo Options actived: $options $dry
echo ""
rsync $options $dry --delete-after --exclude=Outbox --exclude=tmp --exclude=logs --exclude=queue $username@$ip:$folder/. $dest
And this is the line in crontab:
*/5 * * * * /usr/local/kerio/sync.sh log > /usr/local/kerio/log