« Newer Snippets
Older Snippets »
9 total  XML / RSS feed 

Remote FTP transfer with ncftpput

When you can't use SCP…

ncftpput -u username -p password ftpperso.free.fr -R -m /local/path /remote/path

What to do when new kernel does not work

Ocassionally things go bad(tm). This has bit me for the second time in approx 3 years now, but generally one needs to load the old FreeBSD kernel to start debugging and going through a box with a fine toothcomb.

The following snipbit gives you an idea what steps to take when rebooting the server so that you can load the previous working copy of the FreeBSD kernel:
When the boot menu appears hit the spacebar to stop the countdown.
Press "6" for "to escape to loader prompt"
unload
load /boot/kernel.old/kernel
boot

Now the old working FreeBSD kerenl is booting up. It would be recommended to copy the last working version to /boot/kernel.last for example so that you can "load /boot/kernel.last/kernel", especially if you are going to be building your kernel multiple times on a server.

Cron zombie killer

This searches for and destroys the zombie processes that linger (and block I/O for an indefinite amount of time) after cron starts up on a shared server:

for each in `ps jauxww | grep Z | grep -v PID | awk '{print $3}'`; do for every in `ps auxw | grep $each | grep cron | awk '{print $2}'`; do kill -9 $every; done; done

Killing an outta whack webmin

ps ax | grep webmin | kill -9 `awk '{print $1}'`

exim router for relaying via a smarthost

User the "begin routers" section add:

route_append:
    driver = manualroute
    domains = *
    transport = remote_smtp
    route_data = "smarthost.host.name byname"

Formatting a disk for use in FreeBSD

Given that this isn't something I do regularly, it's handy to have the commands to hand so I don't have to scroll through man pages trying to remember how to do it.

Clear the disk
# dd if=/dev/zero of=/dev/ad1 bs=1k count=1


Initialise it
# fdisk -BI ad1


Label it, then edit the labels created
# bsdlabel -B -w ad1s1 auto
# bsdlabel -e ad1s1


Format it with a filesystem
# newfs /dev/ad1s1e


Make directories and mount as appropriate, and you're done!

Using pw to add a group and user in FreeBSD

Using "textdrive" as an example

pw groupadd textdrive
pw useradd textdrive -m -c "Main Textdrive account" -d /home/textdrive -s /bin/tcsh -G textdrive -k /usr/share/skel/


Then set the password:

passwd textdrive

View processes, grep out by user and then kill all their PIDs

ps axu | grep user | kill -9 `awk{print $2}�`
« Newer Snippets
Older Snippets »
9 total  XML / RSS feed