Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Wednesday, December 3, 2008

FTP Using a Shell Script

Manually transferring a file or files via FTP is a common and convenient method for moving data from one computer to another, especially if it’s a non-recurring event. But the reality is there are many times when an event is recurring and calls for immediate automation. This can be done by using a simple UNIX script file, which can then be executed via command line interface or added to the crontab. In the shell script, myftp.sh, example below, I'm FTP’ing binary type files (pictures) from a local computer to a remote while logging the activity.

Note: Some organizational policies may not allow login/password information in a script file.

# vi myftp.sh
#! /bin/sh
REMOTE='esoft'
USER='anyuser'
PASSWORD='myftp125'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
cd /myraid/dailyjpgs
mput *.jpg
quit
_FTP
:wq!


Run via CLI
# ./myftp.sh

Add it to the crontab
# crontab -e

Alternate post: FTP Using One-Liner and Perl Script

Per commenter's request: (call login and password outside of script)

# cat > /export/ftp/.user.txt
anyuser
control+d

# cat > /export/ftp/.passwd.txt
myftp125
control+d

# vi myftp.sh
#! /bin/sh
REMOTE='esoft'
USER=`cat /export/ftp/.user.txt`
PASSWORD=`cat /export/ftp/.passwd.txt`
FTPLOG='/tmp/ftplog'
date >> $FTPLOG

ftp -n $REMOTE <<_FTP>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin cd /myraid/dailyjpgs
mput *.jpg
quit
_FTP
:wq!

Read More......

Install a Solaris Boot Block

Here is a convenient procedure to know for Solaris 8 and below. Usually after a / partition recovery, I use it to install a server's or workstation's boot block. For most people, the second argument is a little difficult to remember. Here is an example.


ok boot cdrom -s
# /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

need to be /usr/sbin/installboot

from a Solaris 10 dvd

/usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0

Read More......

Sun email servers

The other day I found a secret hidden feature of the email server we use internally in Sun. If you log in to the email erver using the web interface, then you select one of your folders and hit the "share" button, it will give some properties of the folder. One of these properties is: "allow direct delivery".

So if I enable it, someone could send email to quenelle+somefolder@sun.com and the email would get directly deposited in ./somefolder in my imap tree. This short-circuits the need for me to add a bazillion filters to the server. (One for each alias I'm on) Instead, I could subscribe to the alias using the address of quenelle+IN/alias-name@sun.com and the mail for that alias would go in ./IN/alias-name.


So adding a new filter for each alias isn't THAT much of a problem, but I can never seem to get it just right. I could resolve it by writing my own custom scripts and uploading them to the server with ldap-write, but that's way more work than I want.

Here's my current annoyance.

My normal setup sends aliases to separate folders, using server-side filters. And email that has my name on it also goes direct to my inbox. Seems simple, right? For mail that only goes to me, it works. For email that only goes to the alias it works. What about mail that is addressed to both me and an alias? What I see coming into my inbox is two copies of a message, each one with both addresses in it (me and the alias).

The server only supports simple rules like: match X: send to Y. So I tell it to match my name and copy to my inbox. And I tell it to match the alias and copy to the alias folder. The result is that for any email to an alias and to me, I get two copies in the folder and two copies in my inbox.

My theory is that if the server directly deposits alias email into the folder, then I'll only see one copy going past my mail filters, and I'll be able to get one copy in my inbox and one copy in the folder (when I get double-addressed email)

Now I just need to find some time to play wth it.

I wish the Roller software would get a built-in editor as good as blogger.com. I have to resort to raw text now, and I'm getting very good at typeing paragraph open/close tags by hand.

Read More......

Monday, December 1, 2008

Instalasi Solaris 9 - Sun Microsystem

Masukan CD/DVD patch, kemudian ikuti perintah2 berikut:

# cd /cdrom/eis-dvd/sun/install
# ./setup-standard.sh
# . /.profile
# cd /cdrom/eis-dvd/sun/patch/9 ---ini bisa disesuaikan dengan solaris serinya
# unpack-patches /tmp
# cd /tmp/9
# eject ----buat ngeluarin cdrom
# ./install_patches

Kemudian bila konfigurasi IP-nya tertinggal pada saat instalasi, lakukanlah langkah2 berikut:
Aktifkan interface

#ifconfig [interface] plumb
cont : # ifconfig bge0 plumb
# ifconfig bge0 192.168.200.90 netmask 255.255.255.0

Untuk nonaktifkan Interface

#ifconfig [interface] unplumb
#ifconfig [interface] down


Set manual IP addres, beberapa yang harus di edit sbb:

# vi /etc/hostname.interface
# vi /etc/inet/ipnode
# vi /etc/inet/hosts
# vi /etc/defaultrouter
# vi /etc/inet/netmasks

Apablila kita ingin meng-aktifkan telnet, lakukan konfigursi ini
#vi /etc/default/login
tutup (beri tanda pagar) pada:
#CONSOLE=/dev/console

Untuk aktipkan FTP
#vi /etc/ftpd/ftpusers
tutup pada
#root

Untuk ssh :

#vi /etc/ssh/sshd_config
PermitRootLoginno
kemudian coba check di terminal
#ps -ef | grep sshd

Read More......