DNETC System V init Script

This week I was looking into init scripts again, its been a while… Anyhow, I remembered that I had written one for distributed.net’s client app.

I thought I would share it, place in “/etc/init.d/dnetc”. It should work fine on current releases of Fedora, RHEL and CentOS. Its designed for the sysadmin to configure dnetc for that system and then manage its start up and shutdown. (Not a script for end users to be using. )

You will need to change the application path to be the directory you have extracted the into.

#!/bin/bash
#
# dnetc This shell script takes care of starting and stopping distributed.net client
#
# chkconfig: 345 90 12
# description: distributed.net client program, a \
# distributed computing project. The program \
# uses only the computers idle time.
# processname: dnetc

# config: /etc/dnetc/dnetc.ini
# pidfile: /var/run/dnetc.pid

# Get function from functions library
. /etc/init.d/functions

start() {
echo -n "Starting DNET client: "
/custom/dnetc/dnetc -quiet
touch /var/lock/subsys/dnetc
success $"DNET client startup"
echo
}

stop() {
echo -n "Stopping DNET client: "
killproc dnetc
rm -f /var/lock/subsys/dnetc
echo
}

# —————————————————————–
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status dnetc
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

This script could do with some more work, I did put it together quickly, but this page helped me get it going and its worth looking at if you want to write a System V init script of your own.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

WordPress Upgrade 2.7 and 2.7.1

Going back to late last year, I upgraded WordPress to 2.7. It all went will apart from some issues with the TinyMCE visual editor. I read a number of articles including Troubleshooting TinyMCE in WordPress 2.7 and http://wordpress.org/support/topic/224121 with no luck. With no plugins and the default theme, i could not get my editor to run correctly. I decided to put up with it, till i had some more time to investigate.

I found that v2.7.1 has now been released, so I rushed to upgrade. I used the new options in the admin section, “Tools > Upgrade > Automatically Upgrade”. The auto upgrade went brilliantly and afterwards my TinyMCE visual editor also started working! Great!

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Firefox SSH protocol handler (Linux)

I have a web page that lists servers I need to connect to. This page has several hyper links for each server to key webpages on that host. I wanted to be able to connect using ssh too, at the click of a link. (eg: ssh://myserver.example.com and ssh://user@myserver.example.com)

I started doing a bit of research into this and have been able to set it up!

On Fedora 10:
1. Open Firefox and go to: about:config.
2. Right Click > New > Boolean > Enter the following name “network.protocol-handler.expose.ssh” and then “true”
3. Right Click > New > Boolean > Enter the following name “network.protocol-handler.external.ssh” and then “true”
4. Right Click > New > Boolean > Enter the following name “network.protocol-handler.warn-external.ssh” and then “false”
5. Right Click > New > String > Enter the following name “network.protocol-handler.app.ssh” and then “firefox-ssh.sh”
6. Close Firefox
7. Create a script here (/usr/local/bin/firefox-ssh.sh) with the following in it:

#!/bin/bash
gnome-terminal -e "ssh echo $1 | sed -e "s/ssh:\/\///""

8. Run chmod +x /usr/local/bin/firefox-ssh.sh
9. Open Firefox and go to a link like ssh://myserver.example.com

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Fedora 10 boot graphics

Fedora 10 has a nice new boot screen. However, I found that I could only see a basic text loading bar at the bottom of the screen. This is due to graphics card support and from what I have read there will be many more cards supported in F11.

If you can’t wait that long, you can try it out. This does not work on all systems, some systems don’t boot when this parameter is present, but if you would like to try it out, and you know what your up to, add “VGA=0×317” to your boot loader kernel line (at boot time to start with).

Mine looks like this:

kernel /vmlinuz-2.6.27.5-117.fc10.x86_64 ro root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rhgb quiet vga=0×317

I tried this on my F10 x86_64 system and it looks great, so I have added the change to /etc/grub/grub.conf.

Good work Fedora!

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Happy New Year!

Well, better late than never. I thought I would take this chance to set myself some ‘open’ goals for the New Year.

First off I hope to get involved in more FOSS advocacy projects, there are a few about which I hope I can contribute too. As part of this, I am going to get involved with or run a Software Freedom Day Event in September so I will be working towards that over the coming months.

I am also hoping to setup a local user group that can help support and guide people through the world of free software. The aim would be to have the group setup before the software freedom event so that it can be promoted as a source of help and further information. This group would help to form a team to run the event, and would enable people to drop in afterwards to learn more, get help and build a local community that can sustain future events.

Migrate another system. I have two systems at work, (two of many overall) one that runs Windows XP, the other Vista. Well it did until I took a Fedora 10 disk to it.

I do run Linux on some of my desktops and its not my first attempt to migrate this poticular one. Its the easier of the two work systems to do so i decided to give it another go. I am hopeful there will be more success this time. I know of 1 or 2 applications that will require Windows so I am going to build a get out of jail free card Virtual Machine on it. This should allow me to use workarounds if needed rather than to revert the system.

My goal is to have it running Fedora all year, even if I have a Windows VM on it.

I am going to try to blog more this year. It will hopefully be a good way of me to give information to the community that has helped me, and howto’s i have completed things or details of how I have over come issues etc.

So now I guess I should get to it, hope you have a Happy New Year!

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Flash 10 on Fedora 10 x86_64

How I setup Flash on my fresh Fedora 10 x86_64 install.

  • Close Firefox
  • Change to the Firefox plugins directory
  • Download the Flash plugin
  • Extract the plugin
  • Remove the .tar.gz as you now have the plugin extracted
  • Open Firefox & you should be away!
cd /usr/lib64/mozilla/plugins/
wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz
tar -xvzf libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz
rm libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Fedora 10!

Finally got around to upgrading to Fedora 10 this week.  I have an issue with downloading podcasts using Amarok, but other that that all is good.  Impressed.  Looking forward to playing with my new install further!

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Delete mail from an exim mail queue

Here is a quick HowTo / TechTip for deleting all the mail from an exim mail queue!

After the issue I blogged about the other day, where a webserver was being used to generate spam, we were left with a lot of spam email in the servers mail queue awaiting delivery.

Amongst other things, this was then causing a performance hit on the server sending messages. I decided that the few real emails in the queue were on no importance and to just delete the whole lot.

Chances are as a sysadmin, its a job you may have to do at some point. This is how I cleaned out the exim queue on the webserver and then the one on the outbound mail server.

First off, take a look at your queue:

[user@www user] exim -bp

As the mail is spam we want to delete it, not empty the queue via SMTP as all the spam will sent to people and our server may be blacklisted.

Delete all the mail in the queue run:

[user@www user] exim -bpru | awk {'print $3'} | xargs exim -Mrm > deletedmail.txt

We can now check how many mails were removed by running:

[user@www user] wc -l deletedmail.txt
13416 deletedmail.txt

We have now deleted all 13416 mails in the queue and the server is as good as new. (Remember to fix the loop hole first, if you don’t you will soon have alot of spam in the queue again!)

The deletedmail.txt file will look something like this:

Message 1K3FYb-0000wH-CF has been removed
Message 1K3FYb-0000wH-6l has been removed
Message 1K3FYb-0000wH-3r has been removed
Message 1K3FYb-0000wH-1d has been removed

On the mail server, we want to remove all mail from the webserver only. To do this we modify the command line to grep for the sending address.

[user@mail user] exim -bpru | grep "" | awk {'print $3'} | xargs exim -Mrm > deletedmail.txt
[user@mail user] wc -l deletedmail.txt
73012 deletedmail.txt

So we have now removed 73012 mails from the mail servers queue. This means in my example here, we have saved the internet from 86428 spam emails.

A few other useful exim queue commands include:

exim -q # Flush waiting mail
exim -qf # Flush all mail
exim -qff # Flush even frozen mail

To remove frozen mail from the local spool, try this…

exim -bpru | grep "*** frozen ***" | awk {'print $3'} | xargs exim -Mrm > deletedmail-frozen.txt
Facebooktwittergoogle_plusredditpinterestlinkedinmail

How to clone a VMware Server virtual machine

Here is a quick guide on how to clone a VMware Server Virtual Machine and bring it up as a new VM in its own right. This allows you to build one base line image and then produce several separate servers from it, or for example, to clone a production VM to test installing a software upgrade on it.

1. First off, you need to have built your source server
2. Now ensure it is shut down & VMware Server shows it as powered off.
3. Next copy the VM’s folder to a new folder eg: copy c:\Virtual_Machines\CentOS_5.1\ to c:\Virtual_Machines\devel-server\
4. Now we need to rename the VMware config file, change into your new VM’s directory and rename the .vmx file. eg: from centos.vmx to devel-server.vmx
5. You now need to change the name of the VM in the config file. Open the .vmx file in a text editor and edit the display name line as required. Ensure this does not clash with any of your other VMs.
eg: form this: displayName = “centos” to this: displayName = “devel-server”
6. You can also rename the disks if you need to, you will also need to change the disk names in the config file. However, I normally setup the disks myself when i create the machine as disk1 disk2 etc and when I clone the server all its disks are duplicated in the new folder, that way i don’t need to rename them and they are completely seperate servers. Nice and clean way of doing things. If your unsure leave your disk files and their entires in your config file alone.
7. Now open VMware Server Console, and connect to your server
8. Then click on File, Open, Browse and locate your new VMX config file in your new VM’s folder.
9. Now you should be able to power up your new VM.
10. You will now need to tell it to create a new UUID when asked

This also works on linux but your server VM path will be more like: /var/lib/vmware/Virtual Machines

Other things to think about, the hostname of your server, and its IP address. These are the two issues people have once they have cloned a server, if its DHCP, your ok, if its static, boot only one at a time.

The first time you boot your new system (The clone) set its hostname and IP configuration.

Stay tuned for my next post: Delete mail, exim mail queue

Facebooktwittergoogle_plusredditpinterestlinkedinmail

VMware Server, on a Laptop

This week I needed to do some testing on two different server setups and did not have any spare boxes handy. I have found in the past that i have spent a lot of time getting hardware together, plugging it in and finding install CD’s.

I set about trying an easier way of testing, and having a good spec laptop which I use day to day, I decided to install VMware Server on it. Then I created a Virtual Machine and installed a clean CentOS 5.1 build on it.

I needed two systems for my testing so decided to keep this install as my “template” or “clean base” and clone it. I would then have “clean”, “server1″ and “server2″. When I finished my testing I could delete the two server VM’s and would be ready to start again next time.

It worked great and I would highly recommend it. (Plus its Free!)

Stay tuned for my next post on: How to clone a VMware Server virtual machine!

Facebooktwittergoogle_plusredditpinterestlinkedinmail