· learnings  · 3 min read

Linux学习日志 Ⅴ

用CUPS服务打印(Printing using CUPS)

Ex. 配置USB打印设备
1.建立usb文件夹
mkdir /dev/usb
●Device files for parallel port printers
–eg /dev/lp0, /dev/lp1, /dev/lp2
●Device files for USB port printers
–eg /dev/usb/lp0, /dev/usb/lp1, /dev/usb/lp2

2.建立”ip0”配置文件
mknod lp0 c 180 0
-------------------------------------------------------------------- # mknod
Must know device major and minor numbers
www.lanana.org/docs/device-list
--------------------------------------------------------------------

3.编辑CUPS配置文件 /etc/cups/printers.conf
<Printer “queue name”>
DeviceURI usb:/dev/usb/lp0         //device URI for this printer
State Idle                       //    Idle/Stopped
Accepting Yes                           //accepting jobs  Yes/No

------------------------------------------------------------------------------ Remote printer:
DeviceURI ipp:///printers/
------------------------------------------------------------------------------

4.重启服务
Service cups restart
------------------------------------------------------------------------------ ●    $ lpr -P
–    Prints specified file to specified queue
●    $ lpq -P
–    Shows status of specified queue
●    $ lprm -P
–    Removes specified job from specified queue

设置网络打印机
在客户端上配置/etc/cups/printers.conf
(其中DeviceURI ipp:///printers/
在服务器上要多配置一个/etc/cups/cupsd.conf来控制客户端
Ex.
<Location /printers/office>
  Order Allow,Deny
  Allow from .syanix.com
  Deny from .msn.com

------------------------------------------------------------------------------

        

        

        

用syslog创建系统记录

1.编辑配置文件/etc/syslog.conf,修改log记录文件路径
Ex. (把安全连接的记录放到/var/log/authlogfile)
Authpriv.*                  /var/log/authlogfile

2.重启服务
service syslog restart
--------------------------------------------------------------------- 记录log到远程remote机器上
在服务器端(接受):
编辑 /etc/sysconfig/syslog
在SYSLOGD_OPTIONS里面添加”-r”
(# -r enable logging from remote machines)

在客户端(发送):
编辑配置文件/etc/syslog.conf
Authpriv.*   @hostname     /var/log/authlogfile
---------------------------------------------------------------------

        

        

Scheduling
***********************************************************
atd Service
Issue appropriate command line to invoke, eg
at -f

crontab Files
crontab files stored as /var/spool/cron/

crontab -e    creates/edits crontab file for that user
crontab -l        lists contents of crontab file for that user
-------------------------------------------------------------- Each crontab entry has following format
min  hour  day  month  day-of-week  command
min:            0-59
hour:            0-23
day:            1-31
month:            1-12
day-of-week:        0-7    (0,7=Sun, 1=Mon, 2=Tue, etc)
-------------------------------------------------------------- Ex.
0 2 1 * *
executesat 2.00am on 1st of each month
30 0-23/4 * * *
executesat 12.30am, 4.30am, 8.30am, 12.30pm, 4.30pm and 8.30pm daily
5,35 8-17 * * 1-5
executesat 8.05am, 8.35am, 9.05am, 9.35am … 5.05pm, 5.35pm on Mondays through to Fridays
15 7-17/5 1,14 1-12/6 3
executesat 7:15am, 12:15pm, 5:15pm on the 1st and 14th of January and July, as well as every Wednesday in January and July

cron Output
MAILTO =
MAILTO =
by itself, disables mailing
cron Security
/etc/cron.allow - lists permitted users
/etc/cron.deny - lists denied users

Clock Synchronization
Network Time Protocol (NTP)
NTP allows for network delays

ntp service
“restrict” entry in /etc/ntp.conf
eg entries for the higher Stratum server
# --- OUR TIMESERVERS ----- server time.ntp.org
restrict time.ntp.org mask 255.255.255.255
notrap nomodify noquery

eg entry for local network
# — CLIENT NETWORK ------- restrict 131.181.116.0 mask 255.255.255.0
nomodify notrap

------------------------------------------------------------------------------------ restrictmask<option/s>
Options include
noquery: host/network not permitted particular NTP queries
nomodify: host/network not permitted to change NTP configuration
notrap: do not accept logging requests from this host/network

●“ntpd”: NTP daemon used to synchronize clock
●“ntpq”: queries NTP server
●“ntpstat”: reports on the status of your time servers
●“ntptrace”: shows the hierarchy of time servers you are using

-------------------------------------------------------------------------------------

    Share:
    Back to Blog