If you want to disable IP routing or packet forwarding in Solaris, simply create this file…
touch /etc/notrouter
Protect the file by issuing the next command:
chmod 400 /etc/notrouter
If you want to disable IP routing or packet forwarding in Solaris, simply create this file…
touch /etc/notrouter
Protect the file by issuing the next command:
chmod 400 /etc/notrouter
If you have played with Linux computers for a while, it is possible that in some ocassions one of them run out of memory for some reason. In this situation it is impossible to run simple commands such as ls. Recently I’ve read a little trick from Prentice Bisbal at Linux Journal that may help.
From Prentice…
About five years ago, a Linux system I was responsible for ran out of memory. Even simple commands, such as ls, failed with an insufficient memory error. The obvious solution to this problem was simply to reboot. One of the other system administrators wanted to look at a file that may have held clues to the problem, but he couldn’t remember the exact name of the file. We could switch to different directories, because the cd command is part of bash, but we couldn’t get a list of the files, because even ls would fail. To get around this problem, the other system administrator created a simple loop to show us the files in the directory:
$ for file in *; do echo $file; done
This worked when ls wouldn’t, because echo is a part of the bash shell, so it already
is loaded into memory. It’s an interesting solution to an unusual problem.
Cool! Isn’t it? Thanks to Prentice Bisbal.
While you are compiling packages and at the same time you are working with your box, probably you’ll notice the machine is less responsive than usual. Although this in principle is not necessarly an abnormal behaviour it could be very annoying.
To diminish the impact of such situation, you could reduce the priority that the kernel assigns to emerge.
Portage provides a configuration parameter that allows you to control this priority. Edit /etc/make.conf and add the following:
PORTAGE_NICENESS=”17″
This will pass “17″ as value to the nice command. Possible values range from “-20″ to “20″, being “-20″ the highest priority and “20″ the lowest. 0 is standard or normal priority.
See nice man page for more info.
The easiest way to do the job is something as follows:
rm ./-file_to_delete
Another approach that is useful for commands that use getopt to parse the arguments is shown next:
rm — -file_to_delete
This tells the command rm (or whatever command that uses getopt) that anything after “–” is not an option.
If you have a big file to back-up to a remote server to which there is a multivolume tape attached, you can tar it even if your device do not change automaticaly the tape:
tar clPM –new-volume-script /root/change_tape \
–tape-length=12582912 –preserve –atime-preserve \
–rsh-command=/usr/bin/ssh -f root@backup:/dev/rmt/2n mnt/backup1
Where…
You can use the next script for this purpose (with no guaranty at all, of course). You have to notice that this script is made for a 6 tapes multivolume device. When the 6th tape is full, you have to place new tapes in the device; no script usefull for this
#!/bin/bash
export tape=`ssh root@backup “mtx -f /dev/rmt/2 status”| awk ‘/Empty/ {a= a + 1; if (a == 1) print $3}’| cut -c1`
case $tape in
6)
echo “change the tapes and tip o”
read a
ssh root@backup “mtx -f /dev/rmt/2 load 1″
echo “load 1″
ssh root@backup “mt -f /dev/rmt/2 rewind”
echo “rewind 1″
export tape=` ssh root@backup “mtx -f /dev/rmt/2 status”| awk ‘/Empty/{ a= a +1; if (a == 1) print $3}’| cut -c1`
case $tape in
1)
exit 0;;
*)
exit 1;;
esac
;;1 | 2 | 3 | 4 | 5)
ssh root@backup “mtx -f /dev/rmt/2 unload”
echo “mtx -f /dev/rmt/2 unload”
ssh root@backup “mtx -f /dev/rmt/2 load `expr $tape + 1`”
echo “load” `expr $tape + 1`
ssh root@backup “mt -f /dev/rmt/2 rewind”
echo “rewind ” `expr $tape + 1`
export tape1=` ssh root@backup “mtx -f /dev/rmt/2 status”| awk ‘/Empty/{ a= a +1; if (a == 1) print $3}’| cut -c1`
echo “tape1 = $tape1″
echo expr $tape1 – $tape – 1
exit `expr $tape1 – $tape – 1`
;;*)
echo “no tape! Please feed me!”;
exit 1
;;
esac
When a process causes a memory violation or issues an illegal instruction or something like that it will probably terminate abnormally and will generate a file named core. This file is a memory image of the process.
The GNU debugger, gdb allows you to determine the program that caused the core dump:
gdb -core core.16124
…and you’ll get something like this:
Using host libthread_db library “/lib/tls/libthread_db.so.1″.
(no debugging symbols found)
Core was generated by `kded’.
Program terminated with signal 6, Aborted.
How to concatenate and/or print files in reverse order? tac is your friend.
From the man page:
Write each FILE to standard output, last line first. With no FILE, or when FILE is -, read standard input.
The easiest way to use it…
tac filename.txt
SchilliX is the first distribution based on OpenSolaris. It is a liveCD and can also be installed on a hard disk on the x86, AMD64 and EM64T based architectures.
According to SchilliX’s website these are the highlights:
Probably at this point you’ve heard a lot of hype regarding Solaris 10. Well, Ben Rockwood’s blog has a quick primer on Sun Solaris 10. Enjoy this nice introduction.
The ldd command lists the dynamic libraries used by a program. This utility is very useful to find out what shared libraries your executables depend on or to do some basic forensic analysis or to help you building chrooted jails.
Simply type this…
ldd /usr/bin/passwd
and you’ll get something like this…
linux-gate.so.1 => (0xffffe000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7fb5000)
libpam.so.0 => /lib/libpam.so.0 (0xb7fab000)
libpam_misc.so.0 => /lib/libpam_misc.so.0 (0xb7fa8000)
libcrack.so.2 => /lib/libcrack.so.2 (0xb7f9c000)
libc.so.6 => /lib/libc.so.6 (0xb7e87000)
libdl.so.2 => /lib/libdl.so.2 (0xb7e83000)
/lib/ld-linux.so.2 (0xb7feb000)