Agus Setiawan's Blog

Life with UNIX/Linux

Archive for the ‘Shell Scripting’ Category

Capture Session Menggunakan Script Command

without comments

Command script di Solaris sangat berguna bagi admin yang ingin mencatat session ketika sedang melakukan suatu pekerjaan di terminal/console. Semua yang diketikkan di terminal akan terekam di sebuah file yang namanya typrescript. File ini secara otomatis ter-create di current directory.

Sebelumnya admin musti mengetikkan command script sebelum memulai pencatatan session :

-bash-3.00# script
Script started, file is typescript

sh-3.00# echo agus setiawan
agus setiawan

sh-3.00# cat /etc/hosts
#
#Internet host table
#
::1     localhost
127.0.0.1       localhost
10.14.206.x    iefile2   loghost
10.14.206.1     gateway
10.14.206.7     gtx

sh-3.00# svcs -a | grep ftp
disabled       23:01:04 svc:/network/ftp:default

sh-3.00# exit

Script done, file is typescript

-bash-3.00# ls -l typescript
-rw-r–r–   1 root     root         517 Aug 29 06:22 typescript

File typescript ini otomatis terbuat setelah kita exit dari command script. Sekarang kita cek, apa aktifitas kita sebelumnya :

-bash-3.00# cat typescript
Script started on Sat Aug 29 06:21:22 2009
sh-3.00# echo agus setiawan

agus setiawan
sh-3.00# cat /etc/hosts
#
#Internet host table
#
::1     localhost
127.0.0.1       localhost
10.14.206.x    iefile2   loghost
10.14.206.1     gateway
10.14.206.7     gtx

sh-3.00# svcs -a | grep ftp

disabled       23:01:04 svc:/network/ftp:default

sh-3.00# exit
script done on Sat Aug 29 06:22:19 2009

Selamat Mencoba.. :D

Written by Agus Setiawan

August 28th, 2009 at 3:17 pm

Posted in Shell Scripting, Syslog