Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:solaris:11:junior:l126 [2016/10/22 05:25] – modification externe 127.0.0.1 | elearning:workbooks:solaris:11:junior:l126 [2020/01/30 03:28] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== | + | ====== |
- | =====Solaris | + | A process is a binary file that is loaded into memory and executed. Everything you do in Solaris |
- | The term Solaris | + | |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * The list of open files. | ||
- | <WRAP center round important 60%> | + | Process environnement data is stored in the **/proc** directory. |
- | Solaris container = Solaris Zone + Solaris Resource Manager ( SRM ) | + | |
- | </WRAP> | + | |
- | The **SRM** is responsible for workload and resource management. | + | =====The /proc File System===== |
- | Solaris Zones are **not** full guest operating system kernels | + | The /proc directory contains virtual files and directories. File content is created dynamically when consulted |
- | There are two types of zones: | + | Start by taking a look at all the directories containing digits: |
- | * a single **Global** zone, | + | < |
- | * one or more **Non-global** or **local** zones. | + | root@solaris: |
+ | 0 | ||
+ | 1 | ||
+ | 1002 104 | ||
+ | 1012 11 1138 1456 1667 203 | ||
+ | 1013 1106 1143 1495 1668 2122 3579 3640 3650 3660 3682 3709 3739 3786 5614 5843 6 | ||
+ | 1014 1109 1159 1661 1822 225 | ||
+ | </ | ||
- | Each local zone requires about 400 Mb of disk space and 15 Mb of RAM. | + | Each of the above directories refers to a PID and contains all the necessary process environnement information. |
- | ====The Global Zone==== | + | =====Process Types===== |
- | The global zone: | + | There are three types of processes |
- | | + | |
- | * provides | + | * **batch** - a process launched by the system at a specific time, |
- | * contains all packages installed by IPS, | + | * **daemon** - a process that has no parent terminal. |
- | | + | |
- | | + | |
- | * contains all configuration data concerning the global zone such as its host name, | + | |
- | | + | |
- | | + | |
- | | + | |
- | ====Non-global or Local Zones==== | + | A process can be in one of 9 //process states//: |
- | A local zone: | + | ^ Process State ^ Description ^ |
+ | | New | The process' | ||
+ | | User Mode | The process executes in user mode | | ||
+ | | Kernel Mode | The process executes in kernel mode | | ||
+ | | New | The process' | ||
+ | | waiting | The process is waiting for a resource other than the processor | | ||
+ | | sleeping | The process is sleeping | | ||
+ | | runnable | The process has everything it needs to run except the processor | | ||
+ | | swap | The process is sleeping in swap | | ||
+ | | elected| The process has control of the processor | | ||
- | * is given a zone ID when it is booted, | + | =====Managing Processes===== |
- | * shares the kernel with the global zone, | + | |
- | * contains a some of the installed packages, | + | |
- | * shares packages with the global zone, | + | |
- | * can contain other software and files not present in the global zone, | + | |
- | * contains a database of all locally installed applications as well as all applications shared by the global zone, | + | |
- | * has no knowledge of the other local zones, | + | |
- | * cannot be used to manage or to un-install local zones, including itself, | + | |
- | * contains all configuration data concerning the local zone such as its host name and IP address, | + | |
- | For those familiar with Solaris 10 zones, there were two types of local zones: | + | ====The ps Command==== |
- | * **//Small zones//** or //Sparse Root zones// where the zone shared | + | The output of the ps caommand shows those processes generated by the user attached to the terminal: |
- | * /usr | + | |
- | * /lib | + | |
- | * /platform | + | |
- | * /sbin | + | |
- | * **//Big zones// | + | |
- | In Solaris 11 only Whole Root Zones remain. | + | <code sh> |
+ | root@solaris: | ||
+ | PID TTY TIME CMD | ||
+ | 6771 pts/1 0:00 ps | ||
+ | 3742 pts/1 0:00 su | ||
+ | 3743 pts/1 0:00 bash | ||
+ | </ | ||
- | + | Used with the **-f** switch, | |
- | =====Lab #1 - Installing a Non-global Zone===== | + | |
- | + | ||
- | In this lab you will be installing a **Local Zone** into a ZFS file system. Start by looking at where you can create | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | NAME USED AVAIL REFER MOUNTPOINT | + | UID |
- | mypool | + | |
- | mypool/ | + | |
- | rpool 7.40G 11.9G 4.58M /rpool | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
- | rpool/ | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | The column headers in the above output are defined as follows: |
- | You **cannot** create zone datasets under the **rpool/ | + | |
- | </ | + | |
- | ====Configuring the Zone's Dataset==== | + | ^ UID | User ID | |
+ | ^ PID | Process Indentification | | ||
+ | ^ PPID | Parent Process ID | | ||
+ | ^ C | Priority| | ||
+ | ^ STIME | Start Time | | ||
+ | ^ TTY | Terminal | | ||
+ | ^ TIME | Duration | | ||
+ | ^ CMD | Command | | ||
- | It seems that the best option is to create a new file system just for zones: | + | To see all the running processes, add the **-e** switch: |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris:~# zfs list | + | |
- | NAME USED AVAIL REFER MOUNTPOINT | + | root |
- | mypool | + | root |
- | mypool/iscsi 103M | + | root |
- | rpool 7.40G 11.9G 4.58M /rpool | + | root |
- | rpool/ROOT 5.22G 11.9G 31K legacy | + | root |
- | rpool/ROOT/ | + | root |
- | rpool/ROOT/solaris-backup-1 | + | root |
- | rpool/ROOT/solaris-backup-1/var 46K 11.9G | + | root |
- | rpool/ROOT/solaris-backup-2 | + | root |
- | rpool/ROOT/solaris-backup-2/var 58K 11.9G | + | root 11 |
- | rpool/ROOT/solaris/var 980M 11.9G | + | root 13 |
- | rpool/VARSHARE | + | root |
- | rpool/dump 1.03G 12.0G 1.00G - | + | pkg5srv |
- | rpool/export | + | |
- | rpool/export/home | + | pkg5srv |
- | rpool/export/ | + | netcfg |
- | rpool/swap 1.03G 12.0G 1.00G - | + | root |
- | rpool/zones 31K 11.9G 31K /zones | + | root 1106 |
+ | trainee | ||
+ | | ||
+ | daemon | ||
+ | root | ||
+ | netadm | ||
+ | daemon | ||
+ | | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | | ||
+ | root | ||
+ | root | ||
+ | | ||
+ | root | ||
+ | root | ||
+ | | ||
+ | | ||
+ | root | ||
+ | | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | netadm | ||
+ | | ||
+ | noaccess | ||
+ | | ||
+ | root | ||
+ | root 1122 | ||
+ | root | ||
+ | daemon | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | | ||
+ | | ||
+ | root 6255 | ||
+ | root 1002 | ||
+ | | ||
+ | root 1012 11 | ||
+ | root 1013 | ||
+ | root 1014 11 | ||
+ | root 1015 11 | ||
+ | | ||
+ | noaccess | ||
+ | root 1119 | ||
+ | root 4985 1 0 Dec 15 ? 0:00 zsched | ||
+ | root 1406 | ||
+ | root 6201 5770 | ||
+ | root 1109 1 0 Dec 15 ? 0:00 / | ||
+ | root 1143 1122 | ||
+ | gdm 1456 | ||
+ | | ||
+ | | ||
+ | | ||
+ | netadm | ||
+ | | ||
+ | | ||
+ | root 6773 3743 0 15:04:31 pts/1 | ||
+ | | ||
+ | | ||
+ | | ||
+ | trainee | ||
+ | | ||
+ | | ||
+ | root 1664 | ||
+ | | ||
+ | root 1661 | ||
+ | | ||
+ | netadm | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | root 6136 | ||
+ | root 6090 | ||
+ | | ||
+ | root 6173 1 0 Dec 15 ? 0:00 / | ||
+ | root 6123 | ||
+ | root 6178 1 0 Dec 15 ? 0:00 / | ||
+ | | ||
+ | | ||
+ | daemon | ||
+ | root 5968 | ||
+ | | ||
+ | | ||
+ | root 5906 | ||
+ | | ||
+ | | ||
+ | root 6174 6173 | ||
+ | root 6180 | ||
+ | root 5889 | ||
+ | root 5770 | ||
+ | | ||
+ | | ||
+ | trainee | ||
+ | | ||
+ | netcfg | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | trainee | ||
+ | | ||
+ | | ||
+ | | ||
+ | root 3742 3741 | ||
+ | | ||
+ | root 3743 3742 | ||
+ | root 5774 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | root 6236 | ||
+ | root 6242 | ||
</ | </ | ||
- | Now create your zone using the **zonecfg** command: | + | ====The top Command==== |
- | < | + | The ps command, although useful, only gives a snapshot view of the processes running at the time the command was executed. To get a continual view of what is running |
- | root@solaris: | + | |
- | Use ' | + | |
- | zonecfg: | + | |
- | create: Using system default template ' | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | The **-z** switch stands for the **zonename**. | + | |
- | </ | + | |
- | + | ||
- | Zones are represented by **XML** files. As you can see above, when created, the zonecfg uses the default template | + | |
< | < | ||
- | root@solaris:~# cat / | + | last pid: |
- | <?xml version=" | + | 141 processes: 140 sleeping, |
+ | CPU states: 93.2% idle, 4.1% user, 2.7% kernel, | ||
+ | Kernel: 1111 ctxsw, 15 trap, 879 intr, 3744 syscall, 4 flt | ||
+ | Memory: 2048M phys mem, 74M free mem, 1024M total swap, 1024M free swap | ||
- | <!-- | + | PID USERNAME NLWP PRI NICE SIZE RES STATE TIME CPU COMMAND |
- | Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. | + | 934 root |
- | + | 3738 trainee | |
- | | + | 3725 trainee |
- | --> | + | 1159 trainee |
- | + | 3661 trainee | |
- | < | + | 3683 trainee |
- | + | 6806 root 1 59 0 4432K 2848K cpu/1 0:00 0.08% top | |
- | <zone name=" | + | 5960 netadm |
- | | + | 3644 trainee |
- | | + | 3698 trainee |
- | link-protection=" | + | 13 root |
- | </ | + | 3640 trainee |
+ | 6136 root | ||
+ | 932 root 7 59 0 | ||
+ | 6216 root | ||
+ | 3688 trainee | ||
+ | 3658 trainee | ||
+ | 104 root 1 59 0 9692K 388K sleep 0:00 0.00% in.mpathd | ||
+ | 1495 pkg5srv | ||
+ | | ||
+ | 1665 pkg5srv | ||
+ | 982 root 1 59 0 6224K 1216K sleep 0:00 0.00% sendmail | ||
+ | 3668 trainee | ||
+ | 1661 root 1 59 0 | ||
+ | 6236 root 1 59 0 6164K 1900K sleep 0:00 0.00% sendmail | ||
+ | 3653 trainee | ||
+ | 5968 root 1 59 0 2592K 1232K sleep 0:00 0.00% dhcpagent | ||
+ | 1138 noaccess | ||
+ | 637 root 1 59 0 9408K 484K sleep 0:00 0.00% dhcpagent | ||
</ | </ | ||
- | Note that you also have set the **autoboot** property to **yes** so that the zone starts on system boot. | + | The default refresh interval is 3 seconds. To make it 1 second, use top' |
- | + | ||
- | To show the configuration that zonecfg has already filled in for you by using the **/ | + | |
< | < | ||
- | zonecfg:myzone> info | + | last pid: |
- | zonename: myzone | + | 141 processes: 138 sleeping, 2 running, 1 on cpu |
- | zonepath: / | + | CPU states: 95.1% idle, 2.9% user, 2.0% kernel, |
- | brand: solaris | + | Kernel: 1084 ctxsw, 10 trap, 894 intr, 4709 syscall, 5 flt |
- | autoboot: true | + | Memory: 2048M phys mem, 69M free mem, 1024M total swap, 1024M free swap |
- | bootargs: | + | Seconds to delay: 1 |
- | file-mac-profile: | + | PID USERNAME NLWP PRI NICE SIZE RES STATE TIME CPU COMMAND |
- | pool: | + | 3725 trainee |
- | limitpriv: | + | 6274 trainee |
- | scheduling-class: | + | 1159 trainee |
- | ip-type: exclusive | + | 3652 trainee |
- | hostid: | + | 3661 trainee |
- | fs-allowed: | + | 3738 trainee |
- | anet: | + | 3683 trainee |
- | linkname: net0 | + | ... |
- | lower-link: auto | + | |
- | allowed-address not specified | + | |
- | configure-allowed-address: true | + | |
- | defrouter not specified | + | |
- | allowed-dhcp-cids not specified | + | |
- | link-protection: mac-nospoof | + | |
- | mac-address: random | + | |
- | mac-prefix not specified | + | |
- | mac-slot not specified | + | |
- | vlan-id not specified | + | |
- | priority not specified | + | |
- | rxrings not specified | + | |
- | txrings not specified | + | |
- | mtu not specified | + | |
- | maxbw not specified | + | |
- | rxfanout not specified | + | |
- | vsi-typeid not specified | + | |
- | vsi-vers not specified | + | |
- | vsi-mgrid not specified | + | |
- | etsbw-lcl not specified | + | |
- | cos not specified | + | |
- | pkey not specified | + | |
- | linkmode not specified | + | |
- | zonecfg: | + | |
</ | </ | ||
- | Finally, **commit** | + | Use the **M** key to sort the processes in descending order of memery usage: |
< | < | ||
- | zonecfg:myzone> commit | + | last pid: |
- | zonecfg:myzone> verify | + | 145 processes: 143 sleeping, 1 zombie, 1 on cpu |
- | zonecfg:myzone> exit | + | CPU states: 89.4% idle, 6.6% user, 4.0% kernel, |
- | root@solaris:~# | + | Kernel: 1037 ctxsw, 5616 trap, 828 intr, 6520 syscall, 5 fork, 3960 flt |
+ | Memory: 2048M phys mem, 197M free mem, 1024M total swap, 1024M free swap | ||
+ | |||
+ | PID USERNAME NLWP PRI NICE SIZE RES STATE TIME CPU COMMAND | ||
+ | 3725 trainee | ||
+ | 3661 trainee | ||
+ | 3685 trainee | ||
+ | 1159 trainee | ||
+ | 3645 trainee | ||
+ | 3648 trainee | ||
+ | 3640 trainee | ||
+ | ... | ||
</ | </ | ||
- | Your zone's configuration is now in its own **XML** file: | ||
- | < | + | ====The fg and bg Commands==== |
- | root@solaris: | + | |
- | <?xml version=" | + | You can launch a process either in the foreground or the background when using bash or ksh. A process running in the background is asynchonous whilst a process in the foreground is synchronous. |
- | < | + | |
- | <!-- | + | |
- | DO NOT EDIT THIS FILE. Use zonecfg(1M) instead. | + | |
- | --> | + | |
- | <zone name=" | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | Display | + | Execute |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | ID NAME | + | [1] 6790 |
- | 0 global | + | |
- | - myzone | + | |
</ | </ | ||
- | The switches used with the **list** subcommand are: | + | In the above output you can see a **job number** between square brackets followed by the PID. The job number is specific to the terminal in which the cammand is executed. |
- | + | ||
- | ^ Switch ^ Description ^ | + | |
- | | -c | Display all zones | | + | |
- | | -v | Display verbose output | | + | |
- | + | ||
- | ====Installing a Zone==== | + | |
- | Now you are ready to install | + | At any point in time, you can display a list of running jobs by using the **jobs** |
< | < | ||
- | root@solaris: | + | root@solaris: |
+ | [1]+ 6790 Running | ||
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | Go grab a cup of coffee or juice ! The installation process can take upto 20 minutes. | + | Note the **+** sign between the job number and PID. This indicates that the job is the last job to have been worked on. A **-** sign indicates that the job was the second to last job thta was worked on. |
</ | </ | ||
- | When installation is complete, you will see something similar | + | If you are running a job in the foreground and you wish to swap it to the background, you first need to pause the process. Pausing a process in Solaris 11 is acheived using **^Z** as shown by the output of the follwing command: |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | The following ZFS file system(s) have been created: | + | speed 38400 baud; |
- | | + | rows = 36; columns = 168; ypixels = 0; xpixels = 0; |
- | Progress being logged to / | + | csdata ? |
- | Image: Preparing at / | + | eucw 1:0:0:0, scrw 1:0:0:0 |
+ | intr = ^c; quit = ^\; erase = ^?; kill = ^u; | ||
+ | eof = ^d; eol = -^?; eol2 = -^?; swtch = < | ||
+ | start = ^q; stop = ^s; susp = ^z; dsusp = ^y; | ||
+ | rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v; | ||
+ | -parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crtscts -crtsxoff -parext | ||
+ | -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc | ||
+ | ixon ixany -ixoff imaxbel | ||
+ | isig icanon -xcase echo echoe echok -echonl -noflsh | ||
+ | -tostop echoctl -echoprt echoke -defecho -flusho -pendin iexten | ||
+ | opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel | ||
+ | </code> | ||
- | AI Manifest: / | + | To understand how ths works, execute the following command: |
- | SC Profile: / | + | |
- | Zonename: myzone | + | |
- | Installation: | + | |
- | Creating IPS image | + | < |
- | Startup linked: 1/1 done | + | root@solaris:~# sleep 1234 |
- | Installing packages from: | + | |
- | | + | |
- | origin: | + | |
- | DOWNLOAD | + | |
- | Completed | + | |
- | PHASE ITEMS | + | </code> |
- | Installing new actions | + | |
- | Updating package state database | + | |
- | Updating image state Done | + | |
- | Creating fast lookup database | + | |
- | Installation: | + | |
- | Note: Man pages can be obtained by installing pkg:/ | + | Now pause the process with ^Z : |
- | done. | + | < |
- | + | root@solaris:~# sleep 1234 | |
- | Done: Installation completed in 3389.965 seconds. | + | ^Z |
- | + | [2]+ Stopped | |
- | + | root@solaris:~# jobs -l | |
- | Next Steps: Boot the zone, then log into the zone console (zlogin | + | [1]- 6790 Running |
- | + | [2]+ 6794 Stopped (user) | |
- | to complete the configuration process. | + | |
- | + | ||
- | Log saved in non-global zone as / | + | |
</ | </ | ||
- | Now use zonesadm' | + | Now the process is paused you can switch it to the background using the **bg** command: |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | ID NAME | + | [2]+ sleep 1234 & |
- | 0 global | + | root@solaris:~# jobs -l |
- | | + | [1]- |
+ | [2]+ 6794 Running | ||
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | Note that the myzone **STATUS** | + | Note that when the job is sent to the background, it automatically starts to run. |
</ | </ | ||
- | ====A Zone's First Boot==== | + | When you want to switch the process back to the foreground, you must again pause it. However, in this case, you cannot use ^Z. Instead you need to send a signal to the process using the **kill** command: |
- | + | ||
- | Verify myzone and then boot it: | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP |
+ | 6) SIGABRT 7) SIGEMT 8) SIGFPE 9) SIGKILL 10) SIGBUS | ||
+ | 11) SIGSEGV 12) SIGSYS 13) SIGPIPE 14) SIGALRM 15) SIGTERM | ||
+ | 16) SIGUSR1 17) SIGUSR2 18) SIGCHLD 19) SIGPWR 20) SIGWINCH | ||
+ | 21) SIGURG 22) SIGIO 23) SIGSTOP 24) SIGTSTP 25) SIGCONT | ||
+ | 26) SIGTTIN 27) SIGTTOU 28) SIGVTALRM 29) SIGPROF 30) SIGXCPU | ||
+ | 31) SIGXFSZ 32) SIGWAITING 33) SIGLWP 34) SIGFREEZE 35) SIGTHAW | ||
+ | 36) SIGCANCEL 37) SIGLOST 38) SIGXRES 39) SIGJVM1 40) SIGJVM2 | ||
+ | 41) SIGRTMIN 42) SIGRTMIN+1 43) SIGRTMIN+2 44) SIGRTMIN+3 45) SIGRTMIN+4 | ||
+ | 46) SIGRTMIN+5 47) SIGRTMIN+6 48) SIGRTMIN+7 49) SIGRTMIN+8 50) SIGRTMIN+9 | ||
+ | 51) SIGRTMIN+10 52) SIGRTMIN+11 53) SIGRTMIN+12 54) SIGRTMIN+13 55) SIGRTMIN+14 | ||
+ | 56) SIGRTMIN+15 57) SIGRTMAX-15 58) SIGRTMAX-14 59) SIGRTMAX-13 60) SIGRTMAX-12 | ||
+ | 61) SIGRTMAX-11 62) SIGRTMAX-10 63) SIGRTMAX-9 64) SIGRTMAX-8 65) SIGRTMAX-7 | ||
+ | 66) SIGRTMAX-6 67) SIGRTMAX-5 68) SIGRTMAX-4 69) SIGRTMAX-3 70) SIGRTMAX-2 | ||
+ | 71) SIGRTMAX-1 72) SIGRTMAX | ||
</ | </ | ||
- | Check if the zone status | + | The signal we need to send is the SIGSTOP: |
< | < | ||
- | root@solaris: | + | oot@solaris: |
- | ID NAME | + | root@solaris:~# jobs -l |
- | 0 global | + | [1]- 6790 Running |
- | | + | [2]+ 6794 Stopped (signal) |
</ | </ | ||
- | Now you can login to the zone using the **zlogin** command: | + | Now you can bring the process |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | [Connected to zone ' | + | sleep 1234 |
+ | ^C | ||
</ | </ | ||
- | Hit < | ||
- | * host name = myzone.fenestros.loc | + | ====The wait command==== |
- | * time zone = Europe/ | + | |
- | * root password | + | |
- | * user name and login = myzone | + | |
- | * user password | + | |
- | Once configured you will see messages similar to the following: | + | The wait command transforms an asynchronous command into a synchronous command. |
- | < | + | For example: |
- | SC profile successfully generated. | + | |
- | Exiting System Configuration Tool. Log is available at: | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Use the tilde-dot ( ~. ) shortcut to leave the zone and return to your global zone: | + | |
< | < | ||
- | ~. | + | root@solaris: |
- | [Connection to zone ' | + | [1]+ 6790 Running |
- | root@solaris: | + | root@solaris: |
+ | ^C | ||
+ | root@solaris: | ||
+ | [1]+ 6790 Running | ||
</ | </ | ||
- | ====Logging into a Zone Directly as Root==== | + | ====The prioctnl Command==== |
- | Log back into the zone as root using the **-S** switch of the **zlogin** command: | + | Whilst |
- | < | + | The priocntl switches are as follows: |
- | root@solaris:~# zlogin -S myzone | + | |
- | [Connected to zone ' | + | |
- | @myzone:~$ whoami | + | |
- | root | + | |
- | @myzone:~$ ~. | + | |
- | [Connection to zone ' | + | |
- | root@solaris: | + | |
- | </ | + | |
- | ====Logging into a Zone as a specific User==== | + | ^ Switch ^ Definition ^ |
+ | | -l | Lists the currently loaded scheduling tasks | | ||
+ | | -d | Displays the scheduling parameters of a process | | ||
+ | | -e | Creates | ||
+ | | -p | Changes the priority of an existing process | | ||
+ | | -c | Specifies the class in which the command executes | | ||
- | To log into the zone as the **myzone** user that you previously created, use the following command: | + | Firstly, display |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | [Connected to zone ' | + | CONFIGURED CLASSES |
- | No directory! Logging in with home=/ | + | ================== |
- | Oracle Corporation SunOS 5.11 11.1 September 2012 | + | |
- | -bash-4.1$ whoami | + | |
- | myzone | + | |
- | -bash-4.1$ ~. | + | |
- | [Connection to zone ' | + | |
- | root@solaris: | + | |
- | </ | + | |
- | =====LAB #2 - Administering Zones===== | + | SYS (System Class) |
- | ====Sharing | + | TS (Time Sharing) |
+ | Configured TS User Priority Range: -60 through 60 | ||
- | To share files between the two zones, you need to configure a LOFS mount. | + | SDC (System Duty-Cycle Class) |
- | In the global zone, create a directory for sharing files: | + | FX (Fixed priority) |
+ | Configured FX User Priority Range: 0 through 60 | ||
- | < | + | IA (Interactive) |
- | root@solaris:~# mkdir -p / | + | Configured IA User Priority Range: -60 through 60 |
- | </ | + | |
- | Now use the **zonecfg** command to configure the share: | + | RT (Real Time) |
+ | Configured RT User Priority Range: 0 through 59 | ||
+ | </ | ||
+ | |||
+ | To display the scheduling parameters of the sleep process created earlier, | ||
< | < | ||
- | root@solaris: | + | root@solaris: |
- | zonecfg:myzone> add fs | + | INTERACTIVE CLASS PROCESSES: |
- | zonecfg: | + | PID[/LWP] IAUPRILIM |
- | zonecfg: | + | 6790 0 0 1 |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | root@solaris: | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | This output shows three columns: |
- | Note that **dir** indicates the mount point in the local zone whilst **special** indicates the share in the global zone. | + | |
- | </ | + | |
- | Now create a file in **/ | + | ^ Column ^ Description ^ |
- | + | | IAUPRILIM | The inter-active per process user priority | | |
- | < | + | | IAUPRI | The inter-active user priority limit | |
- | root@solaris: | + | | IAMODE | The inter-active mode bit. When set, the process is given a priority boost of 10 | |
- | </ | + | |
- | Reboot myzone, check it is up and running, log into myzone as root and check you can see the share. Finally, create a file in **/ | + | To now modify the process priority ( nice value ) of your sleep command, use the following command |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | root@solaris: |
- | ID NAME | + | INTERACTIVE CLASS PROCESSES: |
- | 0 global | + | PID[/LWP] |
- | 2 myzone | + | 6790 0 -5 1 |
- | root@solaris: | + | |
- | [Connected to zone ' | + | |
- | @myzone:~$ cd /root | + | |
- | @myzone: | + | |
- | share | + | |
- | @myzone: | + | |
- | testshare | + | |
- | @myzone: | + | |
- | @myzone: | + | |
- | shareback | + | |
</ | </ | ||
- | Leave myzone and check if you can see the **shareback** file from the global zone: | + | <WRAP center round important 60%> |
+ | Note that a negative value reduces | ||
+ | </ | ||
- | < | ||
- | @myzone: | ||
- | [Connection to zone ' | ||
- | root@solaris: | ||
- | shareback | ||
- | </ | ||
- | You can also share the global zone's DVD-ROM drive. However do **not** use the process explained above since it creates a permanent LOFS mount which will stop you ejecting the DVD from the global zone's DVD-ROM drive whilst the local zone is running: | + | ====The nohup Command==== |
- | < | + | The nohup utility invokes the named command with the arguments supplied. When the command is invoked, nohup arranges for the SIGHUP signal to be ignored by the process. When invoked with the -p or -g switches, nohup arranges for processes already running as identified by a list of process IDs or a list of process group IDs to become immune to hang-ups. |
- | root@solaris: | + | |
- | root@solaris: | + | |
- | 32Bit | + | |
- | 64Bit | + | |
- | AUTORUN.INF | + | |
- | root@solaris: | + | |
- | </ | + | |
- | Now check you can see the contents of the DVD from within the local zone: | + | root@solaris:~# nohup lp /root/sales & |
- | < | ||
- | root@solaris: | ||
- | 32Bit | ||
- | 64Bit | ||
- | AUTORUN.INF | ||
- | autorun.sh | ||
- | cert | ||
- | OS2 | ||
- | runasroot.sh | ||
- | VBoxLinuxAdditions.run | ||
- | VBoxSolarisAdditions.pkg | ||
- | VBoxWindowsAdditions-amd64.exe | ||
- | VBoxWindowsAdditions-x86.exe | ||
- | VBoxWindowsAdditions.exe | ||
- | </ | ||
- | Finally unmount the DVD-Rom and eject it: | ||
- | < | + | =====proc tools===== |
- | root@solaris: | + | |
- | root@solaris: | + | |
- | cdrom / | + | |
- | </ | + | |
- | ====Removing the Share==== | + | ====pcred==== |
- | In order to remove | + | The **pcred** command shows the owner of a specified process: |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | zonecfg: | + | 1: e/r/suid=0 |
- | fs: | + | |
- | dir: /root/share | + | |
- | special: | + | |
- | raw not specified | + | |
- | type: lofs | + | |
- | options: [rw, | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | root@solaris: | + | |
</ | </ | ||
- | ====Allocating CPU Resources==== | + | ====pfiles==== |
- | First, lets see what the non-global zone currently sees as available processors: | + | The **pfiles** command output diplays |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | Status of virtual processor 0 as of: 12/15/2012 06:54:05 | + | 1: /usr/sbin/init |
- | | + | Current rlimit: 256 file descriptors |
- | The i386 processor operates at 2271 MHz, | + | 0: S_IFIFO mode:0600 dev:585,1 ino:4616249 uid:0 gid:0 size:0 |
- | and has an i387 compatible floating point processor. | + | |
- | Status of virtual processor | + | |
- | | + | 253: S_IFREG mode:0444 dev:583,1 ino:65538 uid:0 gid:0 size:0 |
- | The i386 processor operates at 2271 MHz, | + | O_RDONLY|O_LARGEFILE FD_CLOEXEC |
- | and has an i387 compatible floating point processor. | + | |
+ | offset:0 | ||
+ | 254: S_IFREG mode:0666 dev:583,1 ino:65539 uid:0 gid:0 size:0 | ||
+ | | ||
+ | | ||
+ | offset:0 | ||
+ | 255: S_IFREG mode:0666 dev:583,1 ino:65539 uid:0 gid:0 size:0 | ||
+ | | ||
+ | / | ||
+ | offset:0 | ||
</ | </ | ||
- | As you can see, the zone has //grabbed// both of the processors available in the global zone. In order to limit the availabilty to just 1 processor, you need to change the zone's configuration: | + | ====pflags==== |
- | < | + | The **pflags** command prints |
- | root@solaris: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | root@solaris: | + | |
- | root@solaris: | + | |
- | Status of virtual processor 0 as of: 12/15/2012 07:12:29 | + | |
- | on-line since 12/15/2012 07:25:33. | + | |
- | | + | |
- | and has an i387 compatible floating point processor. | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | The dedicated cpu is now invisible to all other non-global zones. You can also define a range of CPUs, such as **1-3**, in which case, when the non-global zone boots, the system will allocate 1 CPU as a minimum | + | |
- | </WRAP> | + | |
- | + | ||
- | Before proceeding further, remove | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris:~# zoneadm -z myzone reboot | + | 1: / |
+ | data model = _ILP32 | ||
+ | / | ||
</ | </ | ||
- | ====Fair Share Scheduler==== | + | ====pldd==== |
- | Another way of sharing resources is to use the Fair Share Scheduler. Firstly, you need to set that scheduler as the default for the system: | + | The **pldd** command lists the dynamic libraries linked into each process: |
- | < | + | < |
- | root@solaris: | + | root@solaris: |
- | root@solaris:~# dispadmin -l | + | 1: / |
- | CONFIGURED CLASSES | + | / |
- | ================== | + | / |
- | + | / | |
- | SYS (System Class) | + | / |
- | TS (Time Sharing) | + | / |
- | SDC (System Duty-Cycle Class) | + | / |
- | FX (Fixed Priority) | + | / |
- | IA (Interactive) | + | / |
- | RT (Real Time) | + | |
- | FSS (Fair Share) | + | |
</ | </ | ||
- | Next set the FSS scheduler as the default for your zone: | + | ====pstack==== |
- | < | + | The **pstack** command prints a hex+symbolic stack trace for each process: |
- | root@solaris: | + | |
- | </ | + | |
- | + | ||
- | Now you can give your global zone 75% of your processors leaving 25% for your zone: | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | zonecfg:global> set cpu-shares=75 | + | 1: / |
- | zonecfg: | + | f4704ed7 pollsys |
- | root@solaris: | + | f46aacc5 poll |
- | zonecfg: | + | 080546b3 main (1, f5d2a00c, f5d2a014, f48278bc) + 427 |
- | zonecfg: | + | 080541ed _start |
</ | </ | ||
- | Finally use the **prstat** command to display the CPU resource balancing: | + | ====ptree==== |
- | < | + | The **ptree** command prints a tree of all running processes showing their dependencies: |
- | PID USERNAME | + | |
- | 3725 trainee | + | |
- | 3738 trainee | + | |
- | 11208 daemon | + | |
- | 1159 trainee | + | |
- | 3661 trainee | + | |
- | 5 root 0K 0K sleep 99 -20 | + | |
- | 3683 trainee | + | |
- | 12971 root 11M 3744K cpu1 | + | |
- | 12134 netadm | + | |
- | 12308 root 5880K 2296K sleep 59 0 | + | |
- | 3645 trainee | + | |
- | 3644 trainee | + | |
- | 12400 root 3964K 1008K sleep 59 0 | + | |
- | 3658 trainee | + | |
- | 814 root 16M 6288K sleep 59 0 | + | |
- | 932 root | + | |
- | 957 root 11M 1144K sleep 59 0 | + | |
- | 818 root 0K 0K sleep 99 -20 | + | |
- | 637 root 9408K 1036K sleep 59 0 | + | |
- | 881 daemon | + | |
- | 95 netadm | + | |
- | 104 root | + | |
- | 85 daemon | + | |
- | 50 root 16M 1560K sleep 59 0 | + | |
- | ZONEID | + | |
- | | + | |
- | | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | Total: 152 processes, 956 lwps, load averages: 0.08, 0.12, 0.12 | + | |
- | </ | + | |
- | ====Allocating Memory==== | + | |
- | + | ||
- | Three types of memory capping are possible within a zone: | + | |
- | + | ||
- | ^ Cap ^ Description ^ | + | |
- | | Physical | Total amount of physical memory available to the zone. Once past the cap, memory pages are paged out | | + | |
- | | Locked | Amount of memory that can be allocated to a greedy application by a zone | | + | |
- | | Swap | Amount of swap space that can be used by a zone | | + | |
- | + | ||
- | To cap the physical memory of a zone, you need to add and correctly configure the **capped-memory** property: | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | zonecfg:myzone> add capped-memory | + | 934 / |
- | zonecfg:myzone:capped-memory> set physical=50m | + | 936 / |
- | zonecfg:myzone:capped-memory> end | + | 957 / |
- | zonecfg:myzone> exit | + | 978 / |
- | root@solaris:~# zonecfg | + | 979 / |
- | capped-memory: | + | 982 / |
- | physical: 50M | + | 1002 / |
+ | 1106 / | ||
+ | 1109 / | ||
+ | 1119 / | ||
+ | 1122 / | ||
+ | 1143 / | ||
+ | 1159 / | ||
+ | 1992 / | ||
+ | 3579 gnome-session | ||
+ | 3620 / | ||
+ | 3644 metacity | ||
+ | 3645 gnome-panel | ||
+ | 3648 nautilus | ||
+ | 3653 / | ||
+ | 3658 / | ||
+ | 3660 python2.6 / | ||
+ | 3661 java -Djava.security.policy=/ | ||
+ | 3668 gnome-power-manager | ||
+ | 3674 / | ||
+ | 3685 gnome-volume-control-applet | ||
+ | 3688 python2.6 / | ||
+ | 1129 / | ||
+ | 1138 / | ||
+ | 1406 / | ||
+ | 1456 / | ||
+ | 1495 / | ||
+ | 1661 / | ||
+ | 1665 / | ||
+ | 1666 / | ||
+ | 1667 / | ||
+ | 1668 / | ||
+ | 1664 / | ||
+ | 1822 zoneadmd | ||
+ | 2122 / | ||
+ | 3608 dbus-launch --exit-with-session --sh-syntax | ||
+ | 3609 / | ||
+ | 3633 / | ||
+ | 3636 / | ||
+ | 3640 / | ||
+ | 3643 / | ||
+ | 3647 / | ||
+ | 3650 / | ||
+ | 3652 / | ||
+ | 3655 / | ||
+ | 3657 / | ||
+ | 3675 / | ||
+ | 3679 / | ||
+ | 3682 / | ||
+ | 3683 / | ||
+ | 3698 / | ||
+ | 3700 / | ||
+ | 3709 / | ||
+ | 3720 / | ||
+ | 3722 / | ||
+ | 3725 / | ||
+ | 3738 gnome-terminal | ||
+ | 3739 gnome-pty-helper | ||
+ | 3741 bash | ||
+ | 3742 su - | ||
+ | 3743 -bash | ||
+ | 6891 sleep 9999 | ||
+ | 6932 ptree | ||
+ | 3782 / | ||
+ | 4985 zsched | ||
+ | 5614 / | ||
+ | 5770 / | ||
+ | 6201 / | ||
+ | 5774 / | ||
+ | 5804 / | ||
+ | 5834 / | ||
+ | 5843 / | ||
+ | 5889 / | ||
+ | 5893 / | ||
+ | 5906 / | ||
+ | 5960 / | ||
+ | 5968 / | ||
+ | 6090 / | ||
+ | 6123 / | ||
+ | 6136 / | ||
+ | 6165 / | ||
+ | 6173 / | ||
+ | 6174 / | ||
+ | 6178 / | ||
+ | 6180 / | ||
+ | 6181 / | ||
+ | 6199 / | ||
+ | 6216 / | ||
+ | 6227 / | ||
+ | 6236 / | ||
+ | 6242 / | ||
+ | 6255 / | ||
+ | 11 / | ||
+ | 985 / | ||
+ | 1012 / | ||
+ | 1013 / | ||
+ | | ||
+ | | ||
+ | 1016 / | ||
+ | 13 / | ||
+ | 42 / | ||
+ | 50 / | ||
+ | 85 / | ||
+ | 95 / | ||
+ | 104 / | ||
+ | 118 / | ||
+ | 191 / | ||
+ | 203 / | ||
+ | 225 / | ||
+ | 235 / | ||
+ | 237 / | ||
+ | 3723 / | ||
+ | 241 / | ||
+ | 413 / | ||
+ | 570 / | ||
+ | 637 / | ||
+ | 679 / | ||
+ | 814 / | ||
+ | 823 / | ||
+ | 874 / | ||
+ | 881 / | ||
+ | 890 / | ||
+ | 891 / | ||
+ | 892 / | ||
+ | 895 | ||
+ | 941 / | ||
+ | 943 / | ||
+ | 996 / | ||
+ | 896 / | ||
+ | 898 / | ||
+ | 899 / | ||
+ | 932 / | ||
+ | 6274 gedit | ||
+ | 6736 nautilus --no-desktop / | ||
</ | </ | ||
- | ====Zone Statistics==== | + | ====pwdx==== |
- | Zone statistics can be displayed by using the **zonestat** command: | + | The **pwdx** command |
- | < | + | < |
- | root@solaris: | + | root@solaris: |
- | Collecting data for first interval... | + | 1: / |
- | Interval: | + | |
- | SUMMARY | + | |
- | ---CPU---- | + | |
- | | + | |
- | [total] | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Interval: 2, Duration: 0:00:10 | + | |
- | SUMMARY | + | |
- | ---CPU---- | + | |
- | | + | |
- | [total] | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Interval: 3, Duration: 0:00:15 | + | |
- | SUMMARY | + | |
- | ---CPU---- | + | |
- | | + | |
- | [total] | + | |
- | | + | |
- | | + | |
- | | + | |
</ | </ | ||
+ | =====Process Scheduling===== | ||
- | ====Non-global Zone Privileges ==== | ||
- | |||
- | Certain things cannot be done from within a non-global zone. The list of privileges assigned to a zone can be displayed as follows: | ||
- | |||
- | < | ||
- | root@solaris: | ||
- | contract_event | ||
- | contract_identity | ||
- | contract_observer | ||
- | cpc_cpu | ||
- | dtrace_kernel | ||
- | dtrace_proc | ||
- | dtrace_user | ||
- | file_chown | ||
- | file_chown_self | ||
- | file_dac_execute | ||
- | file_dac_read | ||
- | file_dac_search | ||
- | file_dac_write | ||
- | file_downgrade_sl | ||
- | file_flag_set | ||
- | file_link_any | ||
- | file_owner | ||
- | file_read | ||
- | file_setid | ||
- | file_upgrade_sl | ||
- | file_write | ||
- | graphics_access | ||
- | graphics_map | ||
- | ipc_dac_read | ||
- | ipc_dac_write | ||
- | ipc_owner | ||
- | net_access | ||
- | net_bindmlp | ||
- | net_icmpaccess | ||
- | net_mac_aware | ||
- | net_mac_implicit | ||
- | net_observability | ||
- | net_privaddr | ||
- | net_rawaccess | ||
- | proc_audit | ||
- | proc_chroot | ||
- | proc_clock_highres | ||
- | proc_exec | ||
- | proc_fork | ||
- | proc_info | ||
- | proc_lock_memory | ||
- | proc_owner | ||
- | proc_priocntl | ||
- | proc_session | ||
- | proc_setid | ||
- | proc_taskid | ||
- | proc_zone | ||
- | sys_acct | ||
- | sys_admin | ||
- | sys_audit | ||
- | sys_config | ||
- | sys_devices | ||
- | sys_ipc_config | ||
- | sys_linkdir | ||
- | sys_mount | ||
- | sys_iptun_config | ||
- | sys_flow_config | ||
- | sys_dl_config | ||
- | sys_ip_config | ||
- | sys_net_config | ||
- | sys_nfs | ||
- | sys_ppp_config | ||
- | sys_res_bind | ||
- | sys_res_config | ||
- | sys_resource | ||
- | sys_share | ||
- | sys_smb | ||
- | sys_suser_compat | ||
- | sys_time | ||
- | sys_trans_label | ||
- | win_colormap | ||
- | win_config | ||
- | win_dac_read | ||
- | win_dac_write | ||
- | win_devices | ||
- | win_dga | ||
- | win_downgrade_sl | ||
- | win_fontpath | ||
- | win_mac_read | ||
- | win_mac_write | ||
- | win_selection | ||
- | win_upgrade_sl | ||
- | </ | ||
+ | ====cron==== | ||
- | ====Changing | + | The **crond** service, launched at boot time, is responsible for executing certain scripts and commands at specific intervals. The crond service assumes that the system is online permanently. In the case of a downtime coinciding with a cronjob, the cronjob is simply not executed until the following period. |
- | To change | + | In Solaris 11, every 60 seconds crond reads the system crontab files ( **/ |
< | < | ||
- | root@solaris: | + | root@solaris: |
+ | # | ||
+ | # | ||
+ | # Copyright 2007 Sun Microsystems, | ||
+ | # Use is subject to license terms. | ||
+ | # | ||
+ | # The root crontab should be used to perform accounting data collection. | ||
+ | # | ||
+ | # | ||
+ | 10 3 * * * / | ||
+ | 15 3 * * 0 [ -x / | ||
+ | 30 3 * * * [ -x / | ||
+ | 30 0, | ||
+ | root@solaris: | ||
+ | # | ||
+ | # | ||
+ | # The sys crontab should be used to do performance collection. See cron | ||
+ | # and performance manual pages for details on startup. | ||
+ | # | ||
+ | # 0 * * * 0-6 / | ||
+ | # 20,40 8-17 * * 1-5 / | ||
+ | # 5 18 * * 1-5 / | ||
+ | root@solaris: | ||
+ | # | ||
+ | # | ||
+ | # The adm crontab file should contain startup of performance collection if | ||
+ | # the profiling and performance feature has been installed. | ||
+ | # | ||
</ | </ | ||
- | Now you can change | + | User crontabs are files named after the user who created them and can be found in **/ |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | adm |
- | ID NAME | + | |
- | 0 global | + | |
- | - myzone1 | + | |
</ | </ | ||
- | ====Changing a Zone's Root Dataset==== | + | The crond service writes to the log file **/ |
- | + | ||
- | To change | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris:~# zoneadm list -cv | + | ! *** cron started *** pid = 1176 Tue Nov 20 19:27:50 2012 |
- | | + | ! SIGTERM Tue Nov 20 22:44:25 2012 |
- | 0 global | + | ! ******* CRON ABORTED ******** Tue Nov 20 22:44:25 2012 |
- | | + | ! *** cron started *** pid = 861 Tue Nov 20 22:46:22 2012 |
+ | > CMD: / | ||
+ | > root 3328 c Wed Nov 21 00:30:00 2012 | ||
+ | < root 3328 c Wed Nov 21 00:34:25 2012 | ||
+ | ! *** cron started *** pid = 871 Sat Dec 1 14:33:18 2012 | ||
+ | > CMD: /usr/ | ||
+ | > | ||
+ | ! time was reset, re-initializing Mon Dec 3 13:13:02 2012 | ||
+ | ! SIGTERM Mon Dec 3 13:14:29 2012 | ||
+ | ! ******* CRON ABORTED ******** Mon Dec 3 13:14:29 2012 | ||
+ | ! *** cron started *** | ||
+ | > CMD: /usr/ | ||
+ | > root 4816 c Fri Dec 7 11:23:09 2012 | ||
+ | ! time was reset, re-initializing Fri Dec 7 11:23:09 2012 | ||
+ | < root 4816 c Fri Dec 7 11:41:03 2012 | ||
+ | > CMD: / | ||
+ | > root 4858 c Fri Dec 7 13:26:23 2012 | ||
+ | ! time was reset, re-initializing Fri Dec 7 13:26:23 2012 | ||
+ | < root 4858 c Fri Dec 7 13:26:23 2012 | ||
+ | > CMD: / | ||
+ | > root 7226 c Mon Dec 10 15:35:15 2012 | ||
+ | ! time was reset, re-initializing Mon Dec 10 15:35:15 2012 | ||
+ | < root 7226 c Mon Dec 10 15:35:15 2012 | ||
+ | ! SIGTERM Tue Dec 11 12:13:34 2012 | ||
+ | ! ******* CRON ABORTED ******** Tue Dec 11 12:13:34 2012 | ||
+ | ! *** cron started *** | ||
+ | > CMD: / | ||
+ | > root 7963 c Tue Dec 11 12:30:00 2012 | ||
+ | < root 7963 c Tue Dec 11 12:30:00 2012 | ||
+ | ! SIGTERM Tue Dec 11 12:43:27 2012 | ||
+ | ! ******* CRON ABORTED ******** Tue Dec 11 12:43:27 2012 | ||
+ | ! *** cron started *** pid = 8011 Tue Dec 11 13:12:56 2012 | ||
+ | ! re-scheduling jobs Tue Dec 11 13:59:39 2012 | ||
+ | ! SIGTERM Tue Dec 11 15:01:00 2012 | ||
+ | ! ******* CRON ABORTED ******** Tue Dec 11 15:01:00 2012 | ||
+ | ! *** cron started *** pid = 9610 Tue Dec 11 15:02:25 2012 | ||
+ | ! SIGTERM Tue Dec 11 15:24:31 2012 | ||
+ | ! ******* CRON ABORTED ******** Tue Dec 11 15:24:31 2012 | ||
+ | ! *** cron started *** pid = 10892 Tue Dec 11 15:25:14 2012 | ||
+ | ! SIGTERM Tue Dec 11 15:32:51 2012 | ||
+ | ! ******* CRON ABORTED ******** Tue Dec 11 15:32:51 2012 | ||
+ | ! *** cron started *** pid = 865 Tue Dec 11 15:34:07 2012 | ||
+ | > CMD: /usr/lib/ | ||
+ | > root 2646 c Wed Dec 12 08:46:52 2012 | ||
+ | ! time was reset, re-initializing Wed Dec 12 08:46:52 2012 | ||
+ | ! SIGTERM Wed Dec 12 08:47:05 2012 | ||
+ | ! ******* CRON ABORTED ******** Wed Dec 12 08:47:05 2012 | ||
+ | ! *** cron started *** pid = 854 Wed Dec 12 08:57:20 2012 | ||
+ | > CMD: / | ||
+ | > root 2375 c Wed Dec 12 09:30:00 2012 | ||
+ | < root 2375 c Wed Dec 12 09:30:00 2012 | ||
+ | > CMD: / | ||
+ | > root 2511 c Wed Dec 12 13:33:08 2012 | ||
+ | ! time was reset, re-initializing Wed Dec 12 13:33:08 2012 | ||
+ | < root 2511 c Wed Dec 12 13:33:08 2012 | ||
+ | > CMD: / | ||
+ | > root 3397 c Thu Dec 13 11:02:43 2012 | ||
+ | ! time was reset, re-initializing Thu Dec 13 11:02:43 2012 | ||
+ | < root 3397 c Thu Dec 13 11:08:46 2012 | ||
+ | > CMD: / | ||
+ | > root 3487 c Thu Dec 13 12:58:15 2012 | ||
+ | ! time was reset, re-initializing Thu Dec 13 12:58:15 2012 | ||
+ | < root 3487 c Thu Dec 13 12:58:15 2012 | ||
+ | > CMD: / | ||
+ | > root 4616 c Fri Dec 14 11:22:45 2012 | ||
+ | ! time was reset, re-initializing Fri Dec 14 11:22:45 2012 | ||
+ | < root 4616 c Fri Dec 14 11:22:45 2012 | ||
+ | > CMD: / | ||
+ | > root 4633 c Fri Dec 14 12:30:19 2012 | ||
+ | < root 4633 c Fri Dec 14 12:30:19 2012 | ||
+ | > CMD: / | ||
+ | > root 14029 c Sat Dec 15 06:21:22 2012 | ||
+ | ! time was reset, re-initializing Sat Dec 15 06:21:22 2012 | ||
+ | ! *** cron started *** pid = 874 Sat Dec 15 07:26:36 2012 | ||
+ | ! time was reset, re-initializing Sat Dec 15 06:26:41 2012 | ||
+ | > CMD: / | ||
+ | > root 6724 c Sat Dec 15 10:39:14 2012 | ||
+ | ! time was reset, re-initializing Sat Dec 15 10:39:14 2012 | ||
+ | < root 6724 c Sat Dec 15 10:39:14 2012 | ||
+ | > CMD: / | ||
+ | > root 6795 c Mon Dec 17 15:47:04 2012 | ||
+ | ! time was reset, re-initializing Mon Dec 17 15:47:04 2012 | ||
+ | < root 6795 c Mon Dec 17 15:47:05 2012 | ||
+ | > CMD: / | ||
+ | > root 6884 c Mon Dec 17 19:24:51 2012 | ||
+ | ! time was reset, re-initializing Mon Dec 17 19:24:51 2012 | ||
+ | < root 6884 c Mon Dec 17 19:24:51 2012 | ||
</ | </ | ||
- | ====Backing Up a Zone==== | + | If a command or script produces an output, that output is sent to root by mail. |
- | Backing up a zone includes backing up the zone configuration | + | The **root** user can establish lists of users that can or cannot create their own crontabs by editing either the **/etc/cron.d/ |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | at.deny |
- | create -b | + | root@solaris: |
- | set brand=solaris | + | daemon |
- | set zonepath=/zones/ | + | bin |
- | set autoboot=true | + | nuucp |
- | set scheduling-class=FSS | + | |
- | set ip-type=exclusive | + | |
- | add anet | + | |
- | set linkname=net0 | + | |
- | set lower-link=auto | + | |
- | set configure-allowed-address=true | + | |
- | set link-protection=mac-nospoof | + | |
- | set mac-address=random | + | |
- | end | + | |
- | add capped-memory | + | |
- | set physical=50M | + | |
- | end | + | |
- | add rctl | + | |
- | set name=zone.cpu-shares | + | |
- | add value (priv=privileged, | + | |
- | end | + | |
</ | </ | ||
- | Now backup the zone's xml file: | + | Each line in a crontab starts with five columns: |
- | < | + | ^ Minutes ^ Hours ^ Day of the month ^ Month ^ Day of the week ^ |
- | root@solaris: | + | | (0-59) |
- | </ | + | |
+ | * 0 is Sunday. | ||
- | ==== Restoring | + | The following examples of values in those columns help explain how versatile |
- | Disaster has struck! Uninstall and delete | + | ^ Example ^ Description ^ |
+ | | An absolute value such as 10 | In the //Minutes// column = 10 minutes after **each** hour | | ||
+ | | A series of values such as 2,6,8 | In the //Month// column = February, June and August | | ||
+ | | A range such as 1-5 | In the //Day of the week// column = From Monday through to Friday | | ||
+ | | The wildcard * | In the //Day of the month// column = Every day of the month | | ||
+ | | A regular interval such as 0-23/2 | In the //Hour// column = Every two hours | | ||
- | < | + | The crond service can be configured by editing the **/etc/default/cron** file: |
- | root@solaris: | + | |
- | Are you sure you want to uninstall zone myzone1 (y/[n])? y | + | |
- | Progress being logged to /var/log/ | + | |
- | root@solaris: | + | |
- | root@solaris: | + | |
- | Are you sure you want to delete zone myzone1 (y/[n])? y | + | |
- | </ | + | |
- | + | ||
- | Now restore myzone1 as follows: | + | |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | # |
- | The following ZFS file system(s) have been created: | + | # Copyright 1991 Sun Microsystems, |
- | | + | # Use is subject |
- | Progress being logged | + | # |
- | Image: Preparing at / | + | #pragma ident " |
- | AI Manifest: / | + | CRONLOG=YES |
- | SC Profile: | + | </code> |
- | Zonename: myzone1 | + | |
- | Installation: | + | |
- | Creating IPS image | + | In this file you can define variables such as PATH for normal users and SUPATH for the root role. |
- | Startup linked: 1/1 done | + | |
- | Installing packages from: | + | |
- | solaris | + | |
- | origin: | + | |
- | DOWNLOAD | + | |
- | Completed | + | |
- | + | ||
- | PHASE ITEMS | + | |
- | Installing new actions | + | |
- | Updating package state database | + | |
- | Updating image state Done | + | |
- | Creating fast lookup database | + | |
- | Installation: | + | |
- | + | ||
- | Note: Man pages can be obtained by installing pkg:/ | + | |
- | + | ||
- | | + | |
- | + | ||
- | Done: Installation completed in 678.453 seconds. | + | |
- | + | ||
- | + | ||
- | Next Steps: Boot the zone, then log into the zone console (zlogin -C) | + | |
- | + | ||
- | to complete the configuration process. | + | |
- | + | ||
- | Log saved in non-global zone as / | + | |
- | </ | + | |
- | Log in as root and check the zone is running correctly: | + | As already stated, each authorized user can create a crontab. To check if a crontab exists, |
< | < | ||
- | root@solaris:~# zlogin | + | trainee@solaris:~$ crontab |
- | [Connected to zone 'myzone1' | + | crontab: can't open your crontab file. |
- | @myzone.solaris.loc: | + | |
- | bin | + | |
</ | </ | ||
- | ====Cloning a Local Zone==== | + | In order to create a crontab, the user should use the following command: |
- | + | ||
- | In this section you are going to create a template zone that you can clone as necessary every time you need to install a new zone. Start by creating a zone called **cleanzone**: | + | |
< | < | ||
- | root@solaris:~# zonecfg | + | trainee@solaris:~$ crontab |
- | Use ' | + | |
- | zonecfg: | + | |
- | create: Using system default template ' | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
- | zonecfg: | + | |
</ | </ | ||
- | Install the zone: | + | ====at==== |
- | < | + | As in the case of cron, root has the ability to control who can and cannot use the at command by editing one of the following: |
- | root@solaris:~# zoneadm -z cleanzone install | + | |
- | The following | + | |
- | rpool/ | + | |
- | Progress being logged to / | + | |
- | | + | |
- | AI Manifest: | + | * **/etc/cron.d/at.allow**, |
- | | + | |
- | Zonename: cleanzone | + | |
- | Installation: | + | |
- | Creating IPS image | + | If the at.allow file exists, only users in that file can use the at command. |
- | Startup linked: 1/1 done | + | |
- | Installing packages from: | + | |
- | solaris | + | |
- | origin: | + | |
- | DOWNLOAD | + | |
- | Completed | + | |
- | PHASE ITEMS | + | Now take the example of root creating two at jobs for the 31/12 at 1pm and 2pm respectively: |
- | Installing new actions | + | |
- | Updating package state database | + | |
- | Updating image state Done | + | |
- | Creating fast lookup database | + | |
- | Installation: Succeeded | + | |
- | Note: Man pages can be obtained by installing pkg:/system/manual | + | < |
- | + | root@solaris:~# at 13:00 Dec 31 | |
- | done. | + | at> pwd > /tmp/test1.atd |
- | + | at> <EOT> | |
- | Done: Installation completed in 797.979 seconds. | + | commands will be executed using / |
- | + | job 1356955200.a at Mon Dec 31 13:00:00 2012 | |
- | + | root@solaris:~# | |
- | Next Steps: Boot the zone, then log into the zone console (zlogin -C) | + | root@solaris:~# at 14:00 Dec 31 |
- | + | at> free > /tmp/test2.atd | |
- | to complete the configuration process. | + | at> <EOT> |
- | + | commands will be executed using /usr/bin/bash | |
- | Log saved in non-global zone as /zones/cleanzone/root/ | + | job 1356958800.a at Mon Dec 31 14:00:00 2012 |
</ | </ | ||
- | Boot the zone to import the zone's manifest: | + | The at files created can be found in **/ |
< | < | ||
- | root@solaris: | + | root@solaris: |
+ | 1356955200.a | ||
</ | </ | ||
- | Login to the zone and hit < | + | Viewing |
< | < | ||
- | root@solaris: | + | root@solaris: |
+ | : at job | ||
+ | : jobname: stdin | ||
+ | : notify by mail: no | ||
+ | : project: 1 | ||
+ | export HZ; HZ='' | ||
+ | export SHELL; SHELL='/ | ||
+ | export TERM; TERM=' | ||
+ | export PAGER; PAGER='/ | ||
+ | export MAIL; MAIL='/ | ||
+ | export PATH; PATH='/ | ||
+ | export PWD; PWD='/ | ||
+ | export LANG; LANG=' | ||
+ | export SHLVL; SHLVL=' | ||
+ | export HOME; HOME='/ | ||
+ | export LOGNAME; LOGNAME=' | ||
+ | export _; _='/ | ||
+ | $SHELL << ' | ||
+ | # | ||
+ | # Copyright 2005 Sun Microsystems, | ||
+ | # Use is subject to license terms. | ||
+ | # | ||
+ | # | ||
+ | cd /root | ||
+ | umask 22 | ||
+ | pwd > / | ||
</ | </ | ||
- | To clone a zone, it first needs to be shutdown: | + | To delete that job you can use the at command with the following syntax: |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | user = root 1356958800.a Mon Dec 31 14:00:00 2012 |
- | ID NAME | + | user = root 1356955200.a Mon Dec 31 13:00:00 2012 |
- | 0 global | + | root@solaris: |
- | 3 myzone1 | + | root@solaris:~# at -l |
- | - cleanzone | + | user = root 1356955200.a Mon Dec 31 13:00:00 2012 |
</ | </ | ||
- | Now create a clone of **cleanzone**: | + | To execute several commands at the same time, it is simple to create a text file containing the commands and then to redirect the contents |
< | < | ||
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | root@solaris: |
- | root@solaris: | + | root@solaris: |
- | The following ZFS file system(s) have been created: | + | root@solaris:~# echo who >> todo.list |
- | | + | root@solaris: |
- | Progress being logged to / | + | pwd |
- | Log saved in non-global zone as /zones/myzone2/root/ | + | free |
+ | who | ||
+ | root@solaris: | ||
+ | commands will be executed using /usr/bin/bash | ||
+ | job 1356960600.a at Mon Dec 31 14:30:00 2012 | ||
</ | </ | ||
- | |||
- | =====References===== | ||
- | |||
- | * **[[http:// | ||
----- | ----- | ||
< | < | ||
<div align=" | <div align=" | ||
- | Copyright © 2011-2015 | + | Copyright © 2019 Hugh Norris. |
- | <a rel=" | + | |
- | </ | + | |
</ | </ |