Categories
Linux Mastering Development

bash script that saves each line of the output from the command

I am having trouble writing a bash script that saves each line of the output from the command #mount | grep ^\/dev/ into a variable. Below is my bash script. #!/bin/bash mount | grep ^\/dev/ > tempoary input=$(cat tempoary) x=0 while IFS= read -r line do x=$((x+1)) echo "$line" > /tmp/directory/$x for file in $(echo […]

Categories
Linux Mastering Development

bash script that saves each line of the output from the command

I am having trouble writing a bash script that saves each line of the output from the command #mount | grep ^/dev/, into a variable. Below is my bash script. #!/bin/bash mount | grep ^/dev/ > tempoary input=$(cat tempoary) x=0 while IFS= read -r line do x=$((x+1)) echo "$line" > /tmp/directory/$x for file in $(echo […]

Categories
Linux Mastering Development

XFS space full and also inode got full too? How could this happen?

# df . -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/vgFOO-lv_bar 53136 52857 279 100% /bar # df . -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vgFOO-lv_bar 50G 50G 20K 100% /bar # find . | wc -l 52855 # lsof /bar | grep -i deleted # # findmnt /bar TARGET SOURCE FSTYPE […]

Categories
Linux Mastering Development

birth/crtime timestamp is recorded on one xfs but not the other xfs filesystem

Two different xfs filesystems on two different Fedora. Why one of them records Birth(crtime) in the inode and why the other one doesn’t? How to find the configuration/attribute differences between the two filesystems? #1 XFS v5 (Fedora 30): # stat tea.txt File: tea.txt Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fd01h/64769d […]

Categories
Mastering Development System & Network

Reading a particular key value from ansible facts

I was tying to pull out below variable value from ansible fact (ansible_mount) as show below. I have lot of mounts in the target machine. What i want is to retrieve only device key value where mount is equal to / . i.e, i want to retrive device value for / mount point. How can […]

Categories
Mastering Development System & Network

Reading a particular key value from ansible facts

I was tying to pull out below variable value from ansible fact (ansible_mount) as show below. I have lot of mounts in the target machine. What i want is to retrieve only device key value where mount is equal to / . i.e, i want to retrive device value for / mount point. How can […]

Categories
Linux Mastering Development

Service file exists but is not found by systemd

I have created a systemd service file and placed it in /etc/systemd/system/anfragen-3dkonfig-mapper.service. I ran systemctl daemon-reload, systemctl daemon-reexec and rebooted the system. systemctl enable anfragen-3dkonfig-mapper results in Failed to enable unit: Unit file anfragen-3dkonfig-mapper.service does not exist. systemctl start anfragen-3dkonfig-mapper results in Failed to start anfragen-3dkonfig-mapper.service: Unit anfragen-3dkonfig-mapper.service not found. ls -lh /etc/systemd/system/anfragen-3dkonfig-mapper.service outputs -rw-r–r–. […]

Categories
Development

Add rows to SQL table based on a list of values

So I have a table like this and an attribute list – (‘attr1’, ‘attr2’, ‘attr3’). id | attr_name | attr_value —————————- 1 | attr1 | val1 1 | attr2 | val2 1 | attr3 | val3 2 | attr1 | val1 2 | attr2 | val4 I want to make a query where this table […]

Categories
Development System & Network

How to ensure a sync write during a cp on a xfs filesystem?

I’m in need for a synchron write to disk of a filecopy (unix cp command) on this xfs filesystem: $ mount | grep /dev/mapper/vg_uservg-pgxlog_archive /dev/mapper/vg_uservg-pgxlog_archive on /pgxlog_archive type xfs (rw,relatime,seclabel,attr2,inode64,noquota) Afaik, the xfs sync interval is 3000 centiseconds which means cached writes: $ sysctl -a | grep “fs.xfs.xfssyncd_centisecs” fs.xfs.xfssyncd_centisecs = 3000 Will the additional xfs […]

Categories
Development

C Pthread Priority : Unable to get expected behavior

Here, I am trying to create two threads, assign priorities/policies to them and get the expected behavior. Expected behavior: Thread which has highest priority(in this case, thread1) should execute always first. What I am seeing: Thread output gets mingled, meaning the priority is not being followed. Here is the code: #include <stdio.h> #include <stdlib.h> #include […]