1 / 16

Advance Unix

Advance Unix. Service Management. There are plenty of GUI tools to control system startup scripts (/etc/init.d/*) The command line tool of choice is called chkconfig

enrico
Download Presentation

Advance Unix

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advance Unix

  2. Service Management • There are plenty of GUI tools to control system startup scripts (/etc/init.d/*) • The command line tool of choice is called chkconfig • chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories (see man chkconfig)

  3. Service Management • To list all the services type chkconfig --list • This will display all the services and there status with each run level and you may want to pipe it to ‘less’ or ‘more’ • To modify or change the run level(s) for when the daemon or service is started type: chkconfig --level <runlevels> <service> on/off

  4. Service Management • So to change the network service to run for levels 3 and 5 only type: chkconfig –level 35 network on • You can also add a service/daemon to your configuration using the –add switch chkconfig --add <service> • To turn a service off or on chkconfig <service> off or on

  5. The “Super Daemon” • xinetd - the extended Internet services daemon (not to be confused with initd) • xinetd performs the same function as inetd: it starts programs that provide Internet services. • Instead of having such servers started at system initialization time, and be dormant until a connection request arrives, • xinetd is the only daemon started and it listens on all service ports for the services listed in its configuration file.

  6. The “Super Daemon” • Benefits are: • Fewer running processes • Access control and logging (PAM) • logging control • log on success, failure, both • specify what is logged (user name, duration) • IMHO the book examples are not that good so here are some of mine: • sshd • cvs • rsync

  7. The “Super Daemon” • /etc/xinetd.conf is the configuration file • /etc/xinetd.d is the directory where all the real info is. • Demo: /etc/xinet.d • Many security experts say you should shut down xinetd and delete the files from /etc/xinet.d -- this is if you are going to really lock down a server • One thing I will say – If you are not using it shut it down/turn it off.

  8. rsync • rsync -avz dir1 node01:. • Option a stands for archive (preserve links and timestamps); v is for verbose and z is for data compression when sending-receiving. • In the case above, rsync was running in the clear • To run rsync over ssh, specify "-e ssh" option: • rsync -e ssh -avz dir1 node01:.

  9. UNIX Scheduler System • The cron system is used to schedule commands to be executed periodically. • The name is derived from Greek chronos (χρόνος), meaning time. • The major components: • crond • crontab • at or batch • Generally, the schedules modified by crontab are enacted by a daemon, crond, • crond runs in the background • checks once a minute to see if any of the scheduled jobs need to be executed. • If so, it executes them. These jobs are generally referred to as cron jobs.

  10. UNIX Scheduler System • The directories: • /etc/cron.d • /etc/cron.hourly • /etc/cron.daily • /etc/cron.weekly • /etc/cron.monthly • The files: • /etc/crontab • /etc/cron.deny • /var/spool/cron/<user-cron> • /etc/cron.allow • /etc/cron.deny

  11. crontab and at commands • crontab commands: • List: crontab –l • Edit: crontab –e • Dump: crontab –l > cronfile • at commands • Edit: at or batch • List: atq • Remove: atrm

  12. Crontab Fields • Minute 0-59 • Hour 0-23 • Day 1-31 • Month 1-12 • Weekday 0-6 (0=Sunday) * Matches everything 1-3 Matches range 1,5 Matches Series

  13. Cron • Write your own Cron file • Format: • Minute Hour Day Month DayofWeek Command • Examples: • 10 0,4,8,12,16,20 * * * ping –c 60 www.yahoo.com • 0 22 * * 5 ./test.sh • Wildcard * for any entry • Comma , indicates multiple values (NO space inside) • Dash – indicate a range • 9-17: from 9am to 5pm • Slash / indicate stepped values • */2 : every 2 hour, minute…

  14. at & batch • at: run command once at a specified time • For example: • at 2:00 • ./test.sh • Ctrl + d to exit • batch: run command once when system is idle • OS decides an appropriate time to run • Similar syntax as at

  15. Crontab Exercise • See Handout or view online at: http://wildbill.org/rose/Spring07/sched_exercise.doc

  16. SCO vs Linux

More Related