Thursday, October 19, 2017

Crontab in aix, concepts and commands in aix?

Crontab in aix, concepts and commands in aix?



v  Deamon - cron
v  Started by - /etc/inittab
v  startup entry - cron:2:respawn:/usr/sbin/cron (or)  cron:2:respawn:/etc/cron
v  file - crontab
v  file location - /var/spool/cron/crontabs/crontab
v  log - /var/adm/cron/log  (error messages about crontab is recorded here)
v  How to list - crontab -l
v  How to edit - crontab -e
v  How to remove - crontab -r
v  Allow - /var/adm/cron/log/cron.allow  (If the file exists, user id must be in the file before it can run cron jobs)
v  Deny - /var/adm/cron/log/cron.deny (If the user is not denied the user may submit the cron jobs)
v  process -  ps -eaf|grep -i cron


v  A crontab entry consists of six fields:

* * * * * Command

The minute (0 through 59)
The hour (0 through 23)
The day of the month (1 through 31)
The month of the year (1 through 12)
The day of the week (0 through 6 for Sunday through Saturday)
The command to run


Sunday, October 15, 2017

Disk is in Removed state in aix, How to fix it?

Disk is in Removed state in aix, How to fix it?


I have faced the below issue.


"lspv" output shows that the disk is in available state however

"lsvg -p datavg" output shows that the disk is in "Removed" state in the lpar.  (disk is virutal disk)


# lspv
hdisk0   0000000012345678 rootvg   active
hdisk1   10000BC987654321 datavg   active
hdisk2   10000CD999654321 datavg   active

# lsvg -p vgname

datavg:
PV_NAME           PV STATE               TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1                   active                          646         486                 130..00..98..129..129
hdisk2                   removed                     646         486                 130..00..98..129..129  

#


Executed the below commands to fix the issue.

# varyonvg datavg   (It didn't helpful as it saying unable to sync the logical volumes)

# chpv -va hdisk1    ( This brought the disk into available state)

# syncvg -v datavg   (Confirmed that all the logical volumes and FS are in open/sync state)



Tuesday, October 3, 2017

How to restore a single file in aix?

How to restore a single file in aix?



If we want to restore a file named healthcheck.ksh from mksysb use the below.


Checking the healthcheck.ksh file existing in the mksysb image.
         
          restore -T -q -l -f /backup/uktest.mksysb | grep healthcheck.ksh


It will list out the detailed output and at the end it will display the file which we need to recover

-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


Restore the particular file healthcheck.ksh using,

          restore -x -q -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

Please note that (.) is important before the file name


cd ./home/unixsa
ls -la healthcheck.ksh
-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


======================================================================

Another method:
---------------------

#lsmksysb -lf /backup/uktest.mksysb
# restorevgfiles -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

New volume on uktest.mksysb
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue May 30 11:54:18 GMT+01:00 2017
Files are backed up by name.
The user is root.
x            267 ./home/unixsa/healthcheck.ksh
The total size is 267 bytes.
The number of restored files is 1.


# ls -la */*
-rw-r--r--    1 root     system            6 Feb 17 11:16 ./home/unixsa/healthcheck.ksh