0

Screen Notes

Telnet into your server. Now run: screen -R -T vt100 Now do whatever you want, open a file with less, edit a file in vi, or start a TUI, or whatever. Now hit that big X in the upper corner. That is right, just toast your telnet session, don’t exit out if it, just toast it. Now log into your server again. Now run: screen -R -T vt100 You should be right back where you left from! Screen does not terminate when your session drops, and it holds whatever programs, or sessions you have open with it open too. Even… Continue Reading

0

Filesystem Corruption on a Veritas Disk

You will need to: 1) boot off of the oscopy disk from the ok prompt boot oscopy -s 2) stop the Veritas volumes vxvol -g rootdg stopall run a vxprint -htrg rootdg and make sure the volumes are disabled 3) fsck -o f -y /dev/rdsk/c#t#d#s0 where c#t#d# it the rootdisk from a vxdisk list reitterate until it gives no errors, or until it only gives the “FILE SYSTEM STATE IN SUPERBLOCK IS WRONG” error. root@hostname: vxdisk list DEVICE TYPE DISK GROUP STATUS c1t0d0s2 sliced appldg01 appldg online c1t1d0s2 sliced appldg02 appldg online c1t2d0s2 sliced – – error c2t0d0s2 sliced rootdisk… Continue Reading

0

Useful Links for Unix Admins

Network Calculators: http://www.subnetmask.info/ Miscilaneous Solaris Notes: http://www.brandonhutchinson.com/Miscellaneous_Solaris_notes.html NIC Speed: http://docs.sun.com/source/816-2128/paramset_2.html Java slow? Research. Ideas: link1 link2 Php arrays: http://us3.php.net/manual/en/function.in-array.php SUN Account PW’s and locking/non-login accts. http://blogs.sun.com/gbrunett/entry/managing_non_login_and_locked

0

Replace Text in Files with Perl

Here’s a really quick way to edit a bunch of files in a search and replace manner. For example, I had 80 files for sending test transactions and had to change the IP Addr when I copied them to each server. I could have manually edited each one, but by using the following, I was able to change it in all 80 in a matter of about 10 seconds. It’s done using “perl” from the command line and is similar to using global replaces within “vi” if you’ve ever used that. perl -pi -e ’s/wordToFind/replaceWithThisWord/’ *.fileExtension perl -pi -e ’s/wordToFind/replaceWithThisWord/g’*.fileExtension… Continue Reading

0

Solaris Patch Return Codes

# 0 No error # 1 Usage error # 2 Attempt to apply a patch that’s already been applied # 3 Effective UID is not root # 4 Attempt to save original files failed # 5 pkgadd failed # 6 Patch is obsoleted # 7 Invalid package directory # 8 Attempting to patch a package that is not installed # 9 Cannot access /usr/sbin/pkgadd (client problem) # 10 Package validation errors # 11 Error adding patch to root template # 12 Patch script terminated due to signal # 13 Symbolic link included in patch # 14 NOT USED # 15… Continue Reading

0

Expect

Expect is really cool, and you can use autoexpect to MAKE an expect script from a session, like a macro recorder! http://www.linuxjournal.com/article/3065 http://www.oreilly.com/catalog/expect/chapter/ch03.html Here is my script to just telnet to port 25 to see the Sendmail version: set timeout 10 spawn telnet $argv 25 match_max 100000 expect -exact “sendmail” send — “quitr” expect eof It was made with autoexpect and then edited, there is some more stuff in the file autoexpect spit out.

0

Use awk to combine lines

Problem: We have a text file containing individual records spanning multiple lines. We want to combine them into one line each. For example, given: fs001d1 VERSION: 8.12.10 fsams001 VERSION: 8.13.7 fsams04p VERSION: 8.13.8 fsams05p VERSION: 8.13.8 fsams06p VERSION: 8.13.8 We want: fs001d1 VERSION: 8.12.10 fsams001 VERSION: 8.13.7 fsams04p VERSION: 8.13.8 fsams05p VERSION: 8.13.8 fsams06p VERSION: 8.13.8 cat output | awk ‘{d=d””$o} /VERSION/ { print d d=”” }’

0

[Solaris]AMPS for Solaris 10

Apache Login as root and copy the /etc/apache2/httpd.conf-example to httpd.conf # cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf Edit /etc/apache2/httpd.conf Set ServerName Set ServerAdmin Enable apache2 # svcadm enable apache2 MySQL Login as root and initalize the database tables # /usr/sfw/bin/mysql_install_db Create mysql user and group # groupadd mysql # useradd -g mysql mysql # chgrp -R mysql /var/mysql # chmod -R 770 /var/mysql # installf SUNWmysqlr /var/mysql d 770 root mysql Copy the mysql config over to /var/mysql # cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf Start mysql daemon # /usr/sfw/sbin/mysqld_safe –user=mysql & Set the root mysql password # /usr/sfw/bin/mysqladmin -u root password ‘new-password’ # /usr/sfw/bin/mysqladmin -u… Continue Reading

0

[Linux]AMP with CentOS 4.4

Mysql Install mysql # yum install mysql mysql-devel mysql-server Edit /etc/init.d/mysqld Edit the lines for restart() from stop start to restart() { stop sleep 3 start } Enable mysql to start at boot time # chkconfig –levels 235 mysqld on /etc/init.d/mysqld start To set root password # mysqladmin -u root password yourrootsqlpassword # mysqladmin -h server1.example.com -u root password yourrootsqlpassword Apache/PHP Install apache # yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel Set apache to start upon boot # chkconfig –levels 235 httpd on