- Cronjobs - a task scheduler
- . . . . .
- Minutes Hour Day Of Month Month Weekly
- Minutes (0-59)
- Hour (0-23)
- Day of Month (1-31)
- Month (1-12)
- Weekly (0-6)
- 0 is Sunday
- Running script at 10:15 every Sunday
- 15 10 * * 0
- Every user has its own crontab
- crontab -e - edit
- crontab -l - list
- crontab -r - remove
- At command is useful for one-time tasks
- # at 9:00 AM
- sh backup.sh
- echo "sh backup.sh" | at 9:00 AM
- atq - list of the scheduled jobs
- atrm 3 - at remove, process id 3
- Using VI, press I to insert, press ESC to remove "insert" mode
- Shift + : + q + !
- Shift + : + X
- LVM (important topic)
- Physical Volume > Volume Group > Logical Volume
- Many disks can be combined, for example, three disks, and one disk is of 10 GB
- So three disks are added into the Volume Group, VG. Which is total 30 GB now.
- After that, a logical volume can be created with different partitions.
- Workflow of LVM:
- First create PV, then VG, then LV.
- Then file system and it is mounted.
- When we have to add more disk after the LVs are already created.
- So, new disk is added as PV first and then to add into VG, use command vgextend
- After that, to add new disk into LV, lvextend is used. After this, then resize command is used to resize the file system.
- First pvcreate /dev/sdb /dev/sdc /dev/sdd
- pvs - to list down the physical volume
- Next step is to create Volume Group:
- vgcreate vg0 /dev/sdb /dev/sdc /dev/sdd
- to list down all vg, write vgs
- the following command can be also used to display vg: vgdisplay
- To create LV, following command can be used:
- lvcreate -L 5G -n lv0 vg0
- To display the list of LV, write lvs
- Next step is to create the file system
- mkfs.ext4 /dev/mapper/vg0-lv0
- Then it is mounted
- mount /dev/mapper/vg0-lv0 /mnt
- Adding new disk to existing VG
- pvcreate /dev/sde
- pvdisplay /dev/sde - shows all the physical drives
- vgdisplay vg0
- Now use following command to extend VG
- vgextend vg0 /dev/sde
- Now extend the LV using the following commands
- lvextend -L +5G /dev/vg0/lv0
- Now to extend LV, file system must be updated, following command can be used:
- resize2fs /dev/vg0/lv0
Recent Pastes