Archive for the ‘Linux OS’ Category

Commonly used ILOM commands

December 27th, 2022, posted in Oracle, Solaris
Share

Integrated Lights-out Manager (ILOM) helps to manage and troubleshoot the complete hardware of a server. With the help of ILOM we can remotely manage a server. We can power on and power off it remotely. Let us see some of the most commonly used commands in the ILOM shell.

 

Login related commands

-> start /SP/console        -- start the SP-console
-> show /SP/sessions        -- see the currently active sessions
-> stop /SP/console         -- to stop any user session

Start and stop system

-> start /SYS                            (start system)  
-> stop [-force] /SYS                    (stop system)
-> show /SYS                             (shows the power status)
-> reset /SYS                            (reset host)
-> reset /SP                             (reset ILOM SP)
-> set /HOST send_break_action=break     (send break signal to the OS)
-> reset /CMM                            (to reset CMM on a blade Chassis)

 

Locator commands

To set the locator on or off

-> set /SYS LOCATE=on
-> set /SYS LOCATE=off

Networking Commands

To see the current network configuration of ILOM

-> show /SP/network

To set an IP address for ILOM

-> set pendingipdiscovery=static 
-> set pendingipaddress=10.10.10.10
-> set pendingipnetmask=255.255.255.0
-> set pendingipgateway=10.10.10.1
-> set commitpending=true

To show SP MAC address

show /SP/network macaddress

If on a Blade chassis, to check the CMM IP :

-> show /CMM/network

User administration

-> show /SP/users                  (Display all the ILOM users)
-> show /SP/user/admin             (Display configuration settings of a specific user)
-> create /SP/users/user_name password=PWD role=[administrator|operator]    (create new user)
-> delete /SP/users/username       (Delete a user)
-> set /SP/users/admin01 role=administrator           (set the role of a user)
-> set /SP/users/admin01           (set or change password of user)

Monitoring and logs

-> show /SP/logs/event/list     (ILOM event log)
-> show -level all -output table /SP/faultmgmt     (List all hardware faults)
-> show -level all -output table /SYS type==Temperature value       (List all temperature sensor readings)

Hardware info

-> show -level all -output table /SYS type==DIMM                (show DIMMS)
-> show -level all -output table /SYS type=='Host Processor'    (show CPUs)
-> show -l all /SYS type=='Hard Disk'                           (show disks)

 

Share

VNC Server On Solaris

November 6th, 2022, posted in Solaris
Share
for S11_u10:
pkg publisher -P
pkg install solaris-desktop


Path should be :

PATH=$PATH:/usr/X11/bin
PATH=$PATH:/usr/openwin/bin
export PATH
Share

Find And Delete Files Older Than Some Particular Time Period In Linux

October 9th, 2022, posted in Solaris
Share

Searching By File Timestamp

Unix/Linux filesystems have three types of timestamp on each file. They are as follows:

  1. Access time (-atime): The timestamp when the file was last accessed.
  2. Modification time (-mtime): The timestamp when the file was last modified.
  3. Change time (-ctime): The timestamp when the metadata for a file (such as permissions or ownership) was last modified.

 

Search and delete file older than 7 days

Lets take an example, wherein we will find and delete file older than 7 days. We will be using the option “-mtime” of the find command for this.

1. Get a list of files using find command as follows:

# find /path_to_directory -mtime +7 -type f -exec ls {}\;

2. If the filenames start with any particular pattern, filter using that as follows:

# find /path_to_directory -name 'filenamepattern*' -mtime +7 -type f -exec ls {}\;

3. After checking and confirming the output, go for removal script(It is very IMPORTANT), otherwise there will be irrecoverable data loss.

# find /path_to_directory -name 'filenamepattern*' -mtime +7 -type f -exec rm -fv {}\;

# find . -name “*.pdf” -atime +7 -exec rm {} \;

4. If this needs to be done on a remote server through cron job and log the filenames of deleted files, use the following command

# ssh user@remote_ip "find /path_to_directory -name 'filenamepattern*' -mtime +7 -type f -exec rm -fv {} \; >> /tmp/backup_deletion`date +%Y%m%d`.log 2>&1"

 

Conclusion

The -mtime parameter will search for files based on the modification time; -ctime searches based on the change time. The -atime, -mtime, and -ctime use time measured in days. The find command also supports options that measure in minutes. These are as follows:

  1. -amin (access time)
  2. -mmin (modification time)
  3. -cmin (change time)

For example, to print all the files that have an access time older than seven minutes, use the following command:

# find . -type f -amin +7 -print

-newer option

The -newer option specifies a reference file with a modification time that will be used to select files modified more recently than the reference file.

Find all the files that were modified more recently than file.txt file:

# find . -type f -newer file.txt -print
Share

Change Solaris Zones Configurations Online

May 29th, 2022, posted in Solaris
Share
I assume you are aware that Solaris Zones are one of the most valuable features of Solaris since years. In this post I focus on the “Live Zone Reconfiguration” feature available since
Solaris 11.2 for Solaris Zones and since Solaris 11.3 for Kernel Zones. CPU pools, filesystems, network and disk configurations can be changed while Solaris Zones are running.

1. Limit CPU usage of a Solaris Zone using dedicated-cpu

By default Solaris Zones share the CPUs with the global and all other local Zones.
Our sample Zone currently uses 16 virtual CPUs.

# zlogin v0131 psrinfo | wc -l
16

 

We can now assign 4 dedicated virtual CPUs to be used by this Zone only.
# zonecfg -z v0131 -r "add dedicated-cpu; set ncpus=4; end"

zone 'v0131': Checking: Adding dedicated-cpu

zone 'v0131': Applying the changes

# zlogin v0131 psrinfo | wc -l
4

 

The “zonecfg -r” changes the configuration of the running Zone only.
Make sure to run the command once again to make the configuration persistent for the next Zone reboot.
# zonecfg -z v0131 "add dedicated-cpu; set ncpus=4; end"

 

2. Create and mount an additional ZFS filesystem
# zfs create v0131_data/myapp

# zonecfg -z v0131 -r "add fs; set type=zfs; set dir=/myapp; set special=v0131_data/myapp; end"

zone 'v0131': Checking: Mounting fs dir=/myapp

zone 'v0131': Applying the changes

# zlogin v0131 mount | grep myapp

/myapp on /myapp read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/zone=v0131/nozonemod/sharezone=4/dev=d50045 on Fri Jun 10 11:56:19 2016

 

And make it persistent
# zonecfg -z v0131 "add fs; set type=zfs; set dir=/myapp; set special=v0131_data/myapp; end"
Adding network interfaces and disk devices are similar to the samples above.
Share

Last Command Examples For Linux And Unix

May 8th, 2022, posted in Solaris
Share

How to find out last logins of users and times informations on Linux/Unix-like operating systems ?

You need to use the last command to show who has recently used the server and logged in and out date/time.

 

The last command reads listing of last logged in users from the system file called /var/log/wtmp or the file designated by the -f options.

Purpose

To find out when a particular user last logged in to the Linux or Unix server.

Syntax

The basic syntax is:

last
last [userNameHere] last [tty] last [options] [userNameHere]

If no options provided last command displays a list of all users logged in (and out) since /var/log/wtmp file was created. You can filter out results by supplying names of users and tty’s to show only those entries matching the username/tty.

last command examples

To find out who has recently logged in and out on your server, type:
$ last
Sample outputs:

root     pts/1        10.1.6.120       Tue Jan 28 05:59   still logged in   
root     pts/0        10.1.6.120       Tue Jan 28 04:08   still logged in   
root     pts/0        10.1.6.120       Sat Jan 25 06:33 - 08:55  (02:22)    
root     pts/1        10.1.6.120       Thu Jan 23 14:47 - 14:51  (00:03)    
root     pts/0        10.1.6.120       Thu Jan 23 13:02 - 14:51  (01:48)    
root     pts/0        10.1.6.120       Tue Jan  7 12:02 - 12:38  (00:35)    
 
wtmp begins Tue Jan  7 12:02:54 2014

You can specifies a file to search other than /var/log/wtmp using -f option. For example, search /nas/server/webserver/.log/wtmp:
$ last -f /nas/server/webserver/.log/wtmp
last -f /nas/server/webserver/.log/wtmp userNameHere

List all users last logged in/out time

last command searches back through the file /var/log/wtmp file and the output may go back to several months. Just use the less command or more command as follows to display output one screen at a time:
$ last | more
last | less

List a particular user last logged in

To find out when user vivek last logged in, type:
$ last vivek
$ last vivek | less
$ last vivek | grep 'Thu Jan 23'


Sample outputs:

Fig. 01 Displaying out when user vivek last logged in on server

Fig. 01 Displaying out when user vivek last logged in on server

Share