顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

[Notes] CUPS 指令參考

2011/10/04 張貼者: Damon.Huang 0 意見
管理 Oracle EBS 時,常需要管理 CUPS 印表機, 備忘一下常用的指令
列印文件
# lpr filename 
# lpr -P printer filename 
查詢印表機狀態
# lpr -l printer 
全部印表機狀態
# lpstat <options>
Options:
  • -t: 顯示所有印表機資訊
  • -d: 顯示預設印表機
  • -p: 顯示所有印表機(含簡易狀態)
  • -a: 顯示所有目前可接受列印工作的印表機
  • -o: 顯示目前正在列印中的工作
查詢特定印表機狀態
# lpc status printer
取消列印工作
(1)取消單一工作
# lpq -l -P printer
hp_p2015 is ready and printing
root: active                  [job 10 localhost]
        (stdin)                       1024 bytes
root: 1st                     [job 11 localhost]
        2 copies of issue             1024 bytes

# lprm [-P printer] 
# lprm 11
(2)清除所有工作
# lprm [-P printer] -
Reset 印表機狀態
# /usr/bin/cupsdisable printer
# /usr/bin/cupsenable printer
Reference:
標籤: ,

[Notes] Linux find 指令參考

張貼者: Damon.Huang 0 意見
標籤: ,

[Howto] - Linux Tape Backup 指令

張貼者: Damon.Huang 0 意見

檢查是系統是否有抓到

[root@example ~]# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 05 Lun: 00
  Vendor: HP       Model: Ultrium 3-SCSI   Rev: G6D
  Type:   Sequential-Access                ANSI SCSI revision: 03
....
....

SCSI TapeDrive 命名規則

Ex: 
   /dev/[n]stX{l,m,a}  => l,m,a 代表壓縮比率
     l: low
     m: medium
     a: high
自動迴帶(rewind) /dev/stX
  每次將資料備入磁帶後,會做自動回帶動作。
  First auto rewind SCSI tape device name: /dev/st0 
  Second auto rewind SCSI tape device name: /dev/st1
[root@example ~]# ls -l /dev/nst0*
crw-rw----  1 root disk 9, 128 Oct  4 08:37 /dev/nst0
crw-rw----  1 root disk 9, 224 Oct  4 08:37 /dev/nst0a
crw-rw----  1 root disk 9, 160 Oct  4 08:37 /dev/nst0l
crw-rw----  1 root disk 9, 192 Oct  4 08:37 /dev/nst0m
非自動迴帶(no-rewind) /dev/nstX
  每次的磁帶寫入後,不做迴帶動作,將讀寫頭(tape head)停留在最後寫入資料的位置.
  First non-rewind SCSI tape device: /dev/nst0
  Second non-rewind SCSI tape device: /dev/nst1
[root@example ~]# ls -l /dev/nst0*
crw-rw----  1 root disk 9, 128 Oct  4 08:37 /dev/nst0
crw-rw----  1 root disk 9, 224 Oct  4 08:37 /dev/nst0a
crw-rw----  1 root disk 9, 160 Oct  4 08:37 /dev/nst0l
crw-rw----  1 root disk 9, 192 Oct  4 08:37 /dev/nst0m

相關操作指令

Check status(檢查狀態)
# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x44 (no translation).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN
狀態值說明:
  • ONLINE: 磁帶機狀態正常且已載入磁帶
  • DR_OPEN: 磁帶機上沒有磁帶
  • BOT: 目前位置在Tape的最開頭(beginning of the tape)
  • EOF: 目前的位置在檔案的開頭(beginning of a file), 容易搞混,就字面而言,是代表(End of file)
  • EOT: 目前位置在Tape的最尾端(end of the tape)
  • EOD: 目前位置在已寫入資料的最尾端(end of recorded media)
  • WR_PROT: 此磁帶狀況為唯讀(read-only)

Erase tape drive(清除)
# mt -f /dev/st0 erase

Unload the tape drive(卸載):
# mt -f /dev/st0 offline

Rewind tape drive(迴帶)
# mt -f /dev/st0 rewind

Backup directory /etc and /var/www 備份資料
# tar -cvf /dev/nst0 /etc /var/www
# tar -zcvf /dev/nst0 /etc /var/www  => 加上壓縮

Display list of files on tape drive(顯示備份資料):
# tar -tvf /dev/nst0 
# tar -tzvf /dev/nst0

Restore /etc drectory(還原備份):
# cd / 
# mt -f /dev/st0 rewind 
# tar -x[z]vf /dev/nst0 etc  

Tape device 也可以往前(Forward)或是往後退(Backward)
  1. Go to end of data(到備份磁帶最後端)
  2. # mt -f /dev/nst0 eod
    

  3. Go to previous record(往後)
  4. # mt -f /dev/nst0 bsfm 1
    

  5. Forward record(往前):
  6. # mt -f /dev/nst0 fsf 1
    

Reference:

標籤:

Linux SSH Tips

2011/07/21 張貼者: Damon.Huang 0 意見
Multiple Connections
第一次連線成功後,再開一個視窗連線同一台主機時,就會用原本的連線來進行連接,也不需要再輸入一次密碼
# vi ~/.ssh/config 
加入以下兩行
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
Avoiding Delays
連線到其他主機時,在出現詢問密碼時,要經過幾十秒的等待
# vi ~/.ssh/config 
GSSAPIAuthentication no
也可直接修改 /etc/ssh/sshd_config
# vi /etc/ssh/sshd_config
GSSAPIAuthentication no
GSSAPIDelegateCredentials no
Example:
##############################
# Connection sharing
##############################
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

##############################
# Persistent connections(4 hrs)
##############################
ControlPersist 4h

##############################
# Hostname Aliases
##############################
Host o1
HostName srv1.example1.com

Host o2
HostName srv2.example1.com
User root

Host neb1
HostName srv3.example2.com
User root

Host neb2
HostName srv4.example2.com
User root

##############################
# Avoiding Delays
##############################
GSSAPIAuthentication no

Reference:

標籤: ,
技術提供:Blogger.