To print a process tree:
ps -ejH xx (where xx is the pid)
ps axjf xx (where xx is the pid)
or in solaris
pstree xx (where xx is the pid0
Wednesday, 19 November 2008
Tuesday, 18 November 2008
How to read a text file into a command
so you have a text file (users.txt) and you want to read that into a script that prints out the users status using the getent command
while read line
do
getent passwd | $line
done < users.txt
and thats it!
while read line
do
getent passwd | $line
done < users.txt
and thats it!
Sunday, 30 March 2008
Solaris 10 zone states
Here's a list of the states a non-global zone can be in:
configured - zone is configured, but it's yet to have its initial boot
incomplete - zoneadm command sets a zone's state to this value while installing and uninstalling a zone. When the operation is completed, zone's status is changed.
installed - zone is fully configured, OS packages have been installed. It's a ready-to-use zone, all you have to do is to boot it. The zone has no virtual platform associated yet.
ready - the zone is ready. It already has a virtual platform established, the kernel has created a zsched process, all the network interfaces are plumbed, devices are configured and file systems are mounted. No processes have been started yet, but since the zone is ready it already has a unique ID assigned to it. We normally don't see a zone in this state, and it always moves one to the next one - running.
running - the zone is up and running. You can connect to the zone. It's a fully working environment now.
shutting down and down - short-term states which are shown when the zone is being halted. Upon completion of halt, the zone gets back into installed state.
configured - zone is configured, but it's yet to have its initial boot
incomplete - zoneadm command sets a zone's state to this value while installing and uninstalling a zone. When the operation is completed, zone's status is changed.
installed - zone is fully configured, OS packages have been installed. It's a ready-to-use zone, all you have to do is to boot it. The zone has no virtual platform associated yet.
ready - the zone is ready. It already has a virtual platform established, the kernel has created a zsched process, all the network interfaces are plumbed, devices are configured and file systems are mounted. No processes have been started yet, but since the zone is ready it already has a unique ID assigned to it. We normally don't see a zone in this state, and it always moves one to the next one - running.
running - the zone is up and running. You can connect to the zone. It's a fully working environment now.
shutting down and down - short-term states which are shown when the zone is being halted. Upon completion of halt, the zone gets back into installed state.
Labels:
non global zone,
solaris 10,
status of non global zone,
zones
Thursday, 6 March 2008
Determine which groups a user belongs to;
Nice & simple this one - use the groups command;
root@xxx > groups user1
other dba staff
so user1 belongs to 3 groups - other, dba & staff
root@xxx > groups user1
other dba staff
so user1 belongs to 3 groups - other, dba & staff
Wednesday, 27 February 2008
Solaris 10 Zones command crib
Zones command crib
----------------------------------
List available zones
zoneadm list –v
-----------------------------------
List status of zones
zoneadm list -cp
-----------------------------------
Login to zone
zlogin –C zonename
-----------------------------------
Logout of a local zone while in a console session / logout of a local zone when logged in from the global zone
~~~.
Logout of a global zone
~.
-----------------------------------
Determine what zone you are in
zonename
-----------------------------------
Command to discover if zone is sparse or whole
# pkgcond is_whole_root_nonglobal_zone
# echo $?
1
# pkgcond is_sparse_root_nonglobal_zone
# echo $?
0
so here the zone is sparse
-----------------------------------
How to get data from a zone without logging into it
(from the global zone)
zlogin zonename cmd
eg
zlogin zonename1 iostat –En
-----------------------------------
From the global zone, show disk stats in human readable form with zone areas included
df –hZ
From the global zone, show processes that are running including zone procs
ps –ef Z
-----------------------------------
Determine disk usage of zones within the partition they reside
du –sk /xx/xx/zonenames*
eg
du –sk /zone/zp*
-----------------------------------------
Determine CPU utilization from the global zone
prstat –Z
-----------------------------------------
Booting a zone
(from the global zone)
zoneadm –z zonename boot
-----------------------------------------
Rebooting a zone
(from the global zone)
zoneadm –z zonename reboot
-----------------------------------------
Halting a zone
(from the global zone – this is used to remove both the application environment and virtual platform for a zone – Zone status is then brought to the ‘installed’ state. All processes are killed, devices unconfigured, network interfaces unplumbed, file systems are unmounted and kernel data structures destroyed)
zoneadm –z zonename halt
-----------------------------------------
Deleting a Zone
(from the global zone, the assumption is that the zone has been halted prior to these actions)
zoneadm –z zonename uninstall
zonecfg –z zonename delete
You can confirm the status of the zone at any time with
zoneadm list –cp
----------------------------------
List available zones
zoneadm list –v
-----------------------------------
List status of zones
zoneadm list -cp
-----------------------------------
Login to zone
zlogin –C zonename
-----------------------------------
Logout of a local zone while in a console session / logout of a local zone when logged in from the global zone
~~~.
Logout of a global zone
~.
-----------------------------------
Determine what zone you are in
zonename
-----------------------------------
Command to discover if zone is sparse or whole
# pkgcond is_whole_root_nonglobal_zone
# echo $?
1
# pkgcond is_sparse_root_nonglobal_zone
# echo $?
0
so here the zone is sparse
-----------------------------------
How to get data from a zone without logging into it
(from the global zone)
zlogin zonename cmd
eg
zlogin zonename1 iostat –En
-----------------------------------
From the global zone, show disk stats in human readable form with zone areas included
df –hZ
From the global zone, show processes that are running including zone procs
ps –ef Z
-----------------------------------
Determine disk usage of zones within the partition they reside
du –sk /xx/xx/zonenames*
eg
du –sk /zone/zp*
-----------------------------------------
Determine CPU utilization from the global zone
prstat –Z
-----------------------------------------
Booting a zone
(from the global zone)
zoneadm –z zonename boot
-----------------------------------------
Rebooting a zone
(from the global zone)
zoneadm –z zonename reboot
-----------------------------------------
Halting a zone
(from the global zone – this is used to remove both the application environment and virtual platform for a zone – Zone status is then brought to the ‘installed’ state. All processes are killed, devices unconfigured, network interfaces unplumbed, file systems are unmounted and kernel data structures destroyed)
zoneadm –z zonename halt
-----------------------------------------
Deleting a Zone
(from the global zone, the assumption is that the zone has been halted prior to these actions)
zoneadm –z zonename uninstall
zonecfg –z zonename delete
You can confirm the status of the zone at any time with
zoneadm list –cp
How many processes a user can have in Solaris?
How to determine how many processes a user can have in Solaris.
Use the sysdef -i command, and grep for processes - see below;
root@server # sysdef -i | grep processes
30000 maximum number of processes (v.v_proc)
29995 maximum processes per user id (v.v_maxup)
Use the sysdef -i command, and grep for processes - see below;
root@server # sysdef -i | grep processes
30000 maximum number of processes (v.v_proc)
29995 maximum processes per user id (v.v_maxup)
Labels:
max no. processes,
processes,
sysdef,
user parameters
Sorting out the Disk hogs!
Sorting out the disk hogs
If you have a full or near full fs, or you are being proactive and doing some preventative housekeeping on directories etc, here are some good commands to use;
du /export/home | sort –nr | more
using this alongside
find /export/home –mtime 1
will get you a pretty good picture of what you want to look at. Note that /export/home is just an example used here, but usually you are looking around that area anyway (or its a good place to start, especially if it sits under the root filesystem)
Alternatively, this is a powerful command;
du –sk * | sort –rnk1
If you have a full or near full fs, or you are being proactive and doing some preventative housekeeping on directories etc, here are some good commands to use;
du /export/home | sort –nr | more
using this alongside
find /export/home –mtime 1
will get you a pretty good picture of what you want to look at. Note that /export/home is just an example used here, but usually you are looking around that area anyway (or its a good place to start, especially if it sits under the root filesystem)
Alternatively, this is a powerful command;
du –sk * | sort –rnk1
Troubleshooting a slow ssh connection
Troubleshooting a slow ssh connection
Try looking in the /etc/nsswitch.conf file in the first instance - it could be that there is a DNS entry on the hosts line;
passwd: files
group: files
hosts: files DNS
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
edit the line to get rid of the DNS
Try looking in the /etc/nsswitch.conf file in the first instance - it could be that there is a DNS entry on the hosts line;
passwd: files
group: files
hosts: files DNS
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
edit the line to get rid of the DNS
Subscribe to:
Posts (Atom)