Thursday, May 13, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


issue with de duping a file record in linux

Posted: 13 May 2021 11:10 AM PDT

I was trying to compare the header of a file is matching with the header in reference file So i wrote both headers in a single file and trying to run the below query. But the same is returning both records instead of returning one record

$ tail -n 2 header_compare.txt | uniq  "ClientID","SendID","SubscriberKey","EmailAddress","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey"  "ClientID","SendID","SubscriberKey","EmailAddress","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey"  

Evenly formatted Ouput

Posted: 13 May 2021 11:01 AM PDT

In linux I have a file like below

123 ABC  456 DEF  GHI 789  

I need output like below

123 ABC  456 DEF  789 GHI  

Locating pip configurations outside of pip.conf

Posted: 13 May 2021 10:48 AM PDT

I am trying to modify pip to exclusively retrieve python packages from my Artifactory server instead of pypi.

my /etc/pip.conf file has only configurations to hit my Artifactory repository however when analyzing network packets I can see I am still retrieving packages from pypi.org

running the locate pip.conf command shows only my /etc/pip.conf file is present. I have also checked for a hidden pip.conf file in my home directory. Is there any other configuration files pip reads from when retrieving Python packages that may be causing this behaviour?

virtual machine (vmware workstation player) - full screen mode scales wrong

Posted: 13 May 2021 09:44 AM PDT

I use VMware workstation 16 player on my Windows10 main operating system. In the virtual machine I use a current version of Ubuntu.

Entering the fullscreen-mode and choosing the option "cycle monitors" basically work, however there is still an issue: When I drag a window, for instance a shell, from my smaller monitor to the bigger monitor, the size of the window remains the same. In the bigger monitor I can then of course make the window bigger, but the size of the text withihn the shell remains the size from the smaller monitor. This leads more than less to unreadable text.

Is there a way to fix this issue?

Any input would be greatly appreciated.

Best Simon

Rsync, copying from two sources: how to avoid deletion of files from first source after syncing files from 2nd source to the same destination?

Posted: 13 May 2021 09:40 AM PDT

I have two source folders I would like to keep synced into the same destination folder. I usually give two separate commands:

rsync -auP --delete-before "/source1/" "/detination/"  rsync -auP --delete-before "/source2/" "/detination/"  

However, when giving the 2nd command, files that were copied from source1 since they are of course not present in source2 they are being removed because of the --delete-before option.

Do you know a way to keep a 1:1 copy of the two sources both syncing into the same destination? I know I could do something like this to resolve:

rsync -auP --delete-before "/source1/" "/detination/source1/"  rsync -auP --delete-before "/source2/" "/detination/source2/"  

But just wanted to check if I can still get the result as mentioned earlier.

After creating separate volume /var/log/ auditd rules for files inside it don't appear in list of active rules

Posted: 13 May 2021 09:34 AM PDT

I've created a separate logical volume /var/log/ and moved contents of the old directory to the new one using rsync to preserve attributes. Logging works fine but audit rules for files inside new partition don't appear in auditctl -l output while being added to /etc/audit/audit.rules by augenrules from /etc/audit/rules.d/*.rules. This is the list of rules which are not getting included to auditctl -l:

-w /var/log/faillog -p wa -k logins  -w /var/log/lastlog -p wa -k logins  -w /var/log/tallylog -p wa -k logins  -w /var/log/wtmp -p wa -k logins  -w /var/log/btmp -p wa -k logins  

Is there any way to troubleshoot rules addition?

degraded iops and throughput on a linux machine in a cluster

Posted: 13 May 2021 09:11 AM PDT

we have a linux-based cluster on AWS with 8 workers.

OS version (taken from /proc/version) is:

Linux version 5.4.0-1029-aws (buildd@lcy01-amd64-021) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #30~18.04.1-Ubuntu SMP Tue Oct 20 11:09:25 UTC 2020

worker id 5 was added recently, and the problem that we see is that during times of high disk util% due to a burst of writes into the workers, the disk mounted to that worker's data dir (/dev/nvme1n1p1) shows a degraded performance in terms of w/sec and wMB/sec, which are much lower on that worker compared to the other 7 workers (~40% less iops and throughput on that broker).

the data in this table was taken from running iostat -x on all the brokers, starting at the same time and ending after 3 hours during peak time. the cluster handles ~2M messages/sec.

another strange behavior is that broker id 7 has ~40% more iops and throughput during bursts of writes compared to the other brokers.

worker type is i3en.3xlarge with one nvme ssd 7.5TB.

any idea as to what can cause such degraded performance in worker id 5 (or such a good performance on broker id 7)?

this issue is causing the consumers from this cluster to lag during high writes because worker id 5 gets into high iowait, and in case some consumer reads gets into lag and performs reads from the disk then the iowait on worker id 5 climbs into ~70% and all consumers start to lag and also the producers get OOM due buffered messages that the broker doesn't accept.

iops & throughput of all workers in the cluster (taken from iostat -x)

make changes the read-only filesystem in OpenELEC

Posted: 13 May 2021 09:04 AM PDT

i want to make changes on the read only filesystem in openelec / libreelec can somebody write me the command lines for making the system folder on usb and compressing it and the kernel to md5 after the changes that I make? Tnx

Linux Routing on Dual Network Interfaces

Posted: 13 May 2021 08:41 AM PDT

I am trying to set up a system where a single server has 2 VLANs and 2 corresponding network interfaces. I want to be able to bind services to a specific interface so it only receives traffic that comes from that IP. This is the current setup:

(ifconfig)    enp28s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000          inet A.B.1.171  netmask 255.255.255.0  broadcast A.B.1.255          inet6 [.....]  prefixlen 64  scopeid 0x20<link>          ether [.....]  txqueuelen 1000  (Ethernet)          RX packets 37262  bytes 6954634 (6.6 MiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 28457  bytes 5529921 (5.2 MiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0      enp28s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000          inet C.D.1.112  netmask 255.255.255.0  broadcast C.D.1.255          inet6 [.....]  prefixlen 64  scopeid 0x20<link>          ether [.....]  txqueuelen 1000  (Ethernet)          RX packets 2314778  bytes 212155740 (202.3 MiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 5446  bytes 604308 (590.1 KiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0      lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1000  (Local Loopback)          RX packets 6600  bytes 420545 (410.6 KiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 6600  bytes 420545 (410.6 KiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    (netstat -rn)    Kernel IP routing table    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface    0.0.0.0         A.B.1.1      0.0.0.0         UG        0 0          0 enp28s0f0    0.0.0.0         C.D.1.1      0.0.0.0         UG        0 0          0 enp28s0f1    A.B.1.0      0.0.0.0         255.255.255.0   U         0 0          0 enp28s0f0    C.D.1.0      0.0.0.0         255.255.255.0   U         0 0          0 enp28s0f1    (ip route)    default via A.B.1.1 dev enp28s0f0 proto static metric 100     default via C.D.1.1 dev enp28s0f1 proto static metric 101     A.B.1.0/24 dev enp28s0f0 proto kernel scope link src A.B.1.171 metric 100     C.D.1.0/24 dev enp28s0f1 proto kernel scope link src C.D.1.112 metric 101  

(I have replaced sensitive info with A,B,C,D)

Currently all inbound traffic is being routed through enp28s0f0. I am able to bind service A to the enp28s0f0 interface IP A.B.1.171 and received traffic it normally. When making a request to service A via the enp28s0f1 interface IP C.D.1.112 it does not go to Service A as expected.

However when I bind service B to the enp28s0f1 interface IP I am not able to receive any traffic at all (I tried requests to both A.B.1.171 and C.D.1.112). My suspicion is that it has something to do with the same gateway 0.0.0.0 being used for both interface subnets, but I'm not completely sure.

Also possibly useful to note that I am currently only using 1 routing table - the default one - this may have an impact but I'm not sure.

The server is running RHEL 7.9. Any help/guidance is appreciated!

LightDM running command after authenticating (pam_exec or other)

Posted: 13 May 2021 10:54 AM PDT

LightDM allows using dm-tool lock to "lock" the session. But I can't find config responsible for authenticating in /etc/pam.d.

  • /etc/pam.d/lightdm - is only during initial login to session
  • /etc/pam.d/lightdm-greeter - works during greeter loading, but before authenticating

I want to run some command every time after LighDM authentication even after dm-tool lock.

pam_exec.so seemed promising but I can't find the right config. What am I missing?

sending csv file via unix

Posted: 13 May 2021 08:39 AM PDT

I am sending an email with content, subject and attachment on a Solaris system. Some users are receiving the mail ok with CSV file and everything, and some users are receiving a content in base64 style like hieroglyphs. The problem is, that when I send email to some domain is working and to some not.

echo ${BODY}; uuencode /data/${FILE} ${FILE}) | mailx -r "mail@mail.com" -s "Export csv file" "mail2@mail2.hr"  

So my question is how to implement in a different way this part of code. It is a bash script and everything works fine (so I don't want to change all of it) but probably I have to change uuencode part. I can not use mutt or mail.

I think Content Type "application/vnd.ms-excel" should be used in my case, but do not know how to implement all this.

Assigning curl output to variable only gives last line [duplicate]

Posted: 13 May 2021 08:30 AM PDT

I am trying to do some tests to see if I can execute a shell script in a variables contents, similar to the Invoke-Expression function in powershell. I am getting the contents of the variable from curl:

a=$(curl https://some.site/test.sh)

however, whenever I print out the variable, it only gives the last line of the shell script.

Is there something I'm missing here? I'm using echo $a to print the variable.

less doesn't page the output when called inside env

Posted: 13 May 2021 10:38 AM PDT

After an update I noticed that my bash profile for man colorization breaks paging. I don't know what changed but I narrowed it down to the fact that calling env less hello.txt results in contents of hello.txt being echoed to the terminal (like cat) without the paging behavior. How do I debug and fix this?

To eliminate the effect of some environment variables, I tested with the minimal environment:

env -i TERM=xterm-256color /usr/bin/less hello.txt  

or even:

env -i /usr/bin/less hello.txt  

This also simply prints the file to stdout. On a different machine with the same software versions, the paging works (if TERM is preserved).

Since even env -i behaves differently, I don't suppose that the reason is something in my environment.

Versions of less and env are the same: less 581.2 (PCRE2 regular expressions) and GNU coreutils 8.32, OS is Arch Linux 64 bit, up to date, shell: GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu).

Convert bash prompt in Terminal to zsh

Posted: 13 May 2021 08:07 AM PDT

I had recently updated Terminal to use zsh, after doing so the prompt on new terminal windows now displays: \[\033[1;92m\]\h:\[\033[0m\] \[\033[0;34m\][\W]\[\033[0m\] \[\033[0;31m\]\u$\[\033[0m\] rather than customized prompt I had set up previously.

Any suggestions for updating the bash profile to display customized prompts again within Terminal or cleaning up the default Terminal prompt to display desired device name, path, etc. using the zsh-based profile?

How to view an email message file (located in a MailDir) from the command line?

Posted: 13 May 2021 10:02 AM PDT

I'm sure I once had a way to read email files from the commandline that was fall-off-a-log simple but I can't for the life of me find it again now.

I have files in MailDir format, I wish to view their contents (headers, body (HTML/plain), MIME-decoded, extract attachments maybe). These aren't my emails; it's not that I want a MUA capable of fetching, sorting, sending mail for me - they're just raw files that I need to inspect.

rsync 100 files of size 30GB each from one remote server to an other in parallel

Posted: 13 May 2021 08:59 AM PDT

I am in need to transfer 100 files of size 30GB each from one remote server to another.

I have saved all the files I want to transfer in a file named to_transfer. most of the files are in such format

  • 1.dat
  • 1.idx
  • 1.vif

all the files are in such pair, n.dat, n.idx, n.vif.

I am using this command.

rsync -azP --remove-source-files --progress --files-from=/storage/to_transfer /storage root@media.evercam.io:/tmp  

This transfer the files one by one but I want to move all the files in parallel, I have a guaranteed bandwidth of 1 GBit/s. How I can make the most out of it?

I am deleting the files after full transfer as well.

How to fetch first regex result from file using bash, grep or sed?

Posted: 13 May 2021 08:06 AM PDT

I have a file called index.html and I grep '<td class="headerCovTableEntryLo">' index.html getting this:

<td class="headerCovTableEntryLo">39.2 %</td>  <td class="headerCovTableEntryLo">56.6 %</td>  

I need to get only 39.2. How can I achieve this ?

What does '/bin/bash: line 2: 30063 Killed' mean?

Posted: 13 May 2021 09:04 AM PDT

I'm trying to install ps2dev a homebrew playstation 2 development toolchain and SDK But I'm having trouble compiling gcc 11.1.0 it stops at

make[2]: Entering directory '/home/david/ps2toolchain-ee/build/gcc/build-mips64r5900el-ps2-elf-stage1/gcc'  build/genautomata ../../gcc/common.md ../../gcc/config/mips/mips.md \ insn-conditions.md > tmp-automata.c  /bin/bash: line 2: 16577 Killed   build/genautomata ../../gcc/common.md ../../gcc/config/mips/mips.md insn-conditions.md > tmp-automata.c  make[2]: *** [Makefile:2459: s-automata] Error 137  make[2]: Leaving directory '/home/david/ps2toolchain-ee/build/gcc/build-mips64r5900el-ps2-elf-stage1/gcc'  make[1]: *** [Makefile:4410: all-gcc] Error 2  make[1]: Leaving directory '/home/david/ps2toolchain-ee/build/gcc/build-mips64r5900el-ps2-elf-stage1'  

I'm quite litterally using my android phone running a linux emulator called UserLAnd running debian/ubuntu

Android Version 8.1.0 (Oreo) Model Alcatel TCL LX A502DL Chipset Mediatek MT6739WM CPU 4x ARM Cortex-A53 @ 1105 MHz (1.1 GHz) GPU PowerVR GE8100 Instruction Set 64-bit ARMv8-A (32-bit Mode) RAM 2GB Internal Storage 16GB

nmtui-connection change my MAC address

Posted: 13 May 2021 08:41 AM PDT

When I use nmtui-connect connect to a Wifi connection, my Wifi connection is changed automatically. I need to put my MAC address into my modem as permit list, but after running nmtui-connect my mac will be changed.

How can I run nmtui-connect without any changing my mac?

Swap super and ctrl keys in xmodmap

Posted: 13 May 2021 10:29 AM PDT

I'm trying to swap my ctrl and super keys. I currently have successfully mapped the super keys to ctrl, now I need to map the ctrl keys to super, but I can't find a way to do so.

Current code:

! Map both super to ctrl  remove mod4 = Super_R  add control = Super_R  remove mod4 = Super_L  add control = Super_L    ! Map both ctrl to super  ! ?  

Thanks in advance.

.conf changes have no effect on reboot in WSL?

Posted: 13 May 2021 09:12 AM PDT

I've tried making some changes in various .conf files in my Ubuntu WSL2 install, such as editing /etc/sysctl.conf with nano, adding vm.max_map_count=262144 at the end of it, saving, then rebooting Windows, and finally checking if vm.max_map_count still = 262144 ...

When I do a sysctl vm.max_map_count it still ends up showing the default 65530.

However, if I do a cat /etc/sysctl.conf I'm still seeing that new line that I added to it, with 262144?

Issue with kernel header files for installing VirtualBox on Debian

Posted: 13 May 2021 11:01 AM PDT

im trying to install virtual box-5.2 (got the .deb file from the website) on my Debian 9 stretch. Currently I have the Kernel: Linux 4.9.0

When I run: sudo dpkg -I virtualbox-5.2_5.2.12-122591~Debian~stretch_amd64.deb I get following error message:

This system is currently not set up to build kernel modules.  Please install the Linux kernel "header" files matching the current kernel  for adding new hardware support to the system.  This system is currently not set up to build kernel modules.  Please install the Linux kernel "header" files matching the current kernel  for adding new hardware support to the system.    There were problems setting up VirtualBox.  To re-start the set-up process, run  /sbin/vboxconfig  as root.  

But when I am trying to install or upgrade the header files with: sudo apt-get install linux-headers-$(uname -r), linux tells me, that the header files are already installed. And when I run /sbin/vboxconfigI get the same error message as above.

Could anyone help with this issue? Thanks!

Queue up commands while one command is being executed

Posted: 13 May 2021 09:40 AM PDT

Suppose you run a command which takes some time to return and want to execute a different command after it has been executed but you didn't plan this in advance.

I know that there is the option to press Ctrl + Z and then submit fg && otherCommand. However, this has two major flaws:

  1. It doesn't work if the first command is a composition of different commands (command1 && command2 or command1; command2) because then the subsequent commands of the first submitted line aren't executed.
  2. Execution of the first command is stopped while you enter the next command. With those nasty 30 second commands, the time you spend entering the next command makes up a good portion of the remaining execution time, if not all of it.

I also know that you can just type in the next command while one command is being executed and then hit Enter to sumbit it. However, this also has two major flaws:

  1. It doesn't work if the command you execute first reads from stdin.
  2. If the command you execute first produces output, you can't see what you entered.

Is there a quick way to queue up more commands while one command is being executed, possibly involving using a special terminal emulator or several terminals?

Can a disk be made to identify specific pending sectors?

Posted: 13 May 2021 11:17 AM PDT

smartd will happily log messages like this:

Sep  2 12:33:59 Watt smartd[438]: Device: /dev/sda, 2 Offline uncorrectable sectors  Sep  2 12:34:01 Watt smartd[438]: Device: /dev/sdc, 16 Currently unreadable (pending) sectors  Sep  2 12:34:01 Watt smartd[438]: Device: /dev/sdc, 16 Offline uncorrectable sectors  

These are all used for mdraid arrays, so it's easily fixable by having mdraid scrub the array. But that takes a good long while (and hurts performance while its going). It'd be much quicker to selectively scrub only the parts that need it.

Is there some way to get the list of pending sectors from the disk? I didn't see anything in smartctl -x, but here is sda and sdc in case it helps. (And yes, sdc is destined for replacement soon.) If I could get a list of sectors, I could feed that to mdraid to scrub only those portions.

These are all SATA disks. The machine is running Debian testing/unstable, if it matters. But I'd love to solve this on machines running Debian stable and oldstable as well.

Starting Tomcat Service when starting CentOS/RHEL/Fedora

Posted: 13 May 2021 09:00 AM PDT

I want to install tomcat 8 and run it at startup time

I am following these tutorials:

  1. Install Tomcat 7 on CentOS, RHEL, or Fedora
  2. How to install Tomcat 8 on a CentOS 6 VPS

I created the tomcat user:

# useradd -U -r -M -d /usr/local/ServerWeb/tomcat -s /sbin/nologin tomcat  

The file was in /etc/init.d/tomcat

In the option 1:

#!/bin/bash    # description: Tomcat Start Stop Restart    # processname: tomcat    # chkconfig: 234 20 80    JAVA_HOME=/opt/jdk  export JAVA_HOME  PATH=$JAVA_HOME/bin:$PATH  export PATH  TOMCAT_HOME=/usr/local/tomcat  TOMCAT_USER=tomcat    case $1 in    start)    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh    ;;     stop)       /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh    ;;     restart)    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh    ;;     esac        exit 0    

In the Option 2:

#!/bin/bash  #  # tomcat  #  # chkconfig: - 80 20  #  ### BEGIN INIT INFO  # Provides: tomcat  # Required-Start: $network $syslog  # Required-Stop: $network $syslog  # Default-Start:  # Default-Stop:  # Description: Tomcat   # Short-Description: start and stop tomcat  ### END INIT INFO    ## Source function library.  #. /etc/rc.d/init.d/functions  export JAVA_HOME=/opt/jdk  export JAVA_OPTS="-Dfile.encoding=UTF-8 \    -Dnet.sf.ehcache.skipUpdateCheck=true \    -XX:+UseConcMarkSweepGC \    -XX:+CMSClassUnloadingEnabled \    -XX:+UseParNewGC \    -XX:MaxPermSize=128m \    -Xms512m -Xmx512m"  export PATH=$JAVA_HOME/bin:$PATH  TOMCAT_HOME=/usr/local/tomcat  TOMCAT_USER=tomcat  SHUTDOWN_WAIT=20    tomcat_pid() {    echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`  }    start() {    pid=$(tomcat_pid)    if [ -n "$pid" ]     then      echo "Tomcat is already running (pid: $pid)"    else      # Start tomcat      echo "Starting tomcat"      ulimit -n 100000      umask 007      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh    fi        return 0  }    stop() {    pid=$(tomcat_pid)    if [ -n "$pid" ]    then      echo "Stoping Tomcat"      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh        let kwait=$SHUTDOWN_WAIT      count=0;      until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]      do        echo -n -e "\nwaiting for processes to exit";        sleep 1        let count=$count+1;      done        if [ $count -gt $kwait ]; then        echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds"        kill -9 $pid      fi    else      echo "Tomcat is not running"    fi      return 0  }    case $1 in  start)    start  ;;   stop)       stop  ;;   restart)    stop    start  ;;  status)    pid=$(tomcat_pid)    if [ -n "$pid" ]    then      echo "Tomcat is running with pid: $pid"    else      echo "Tomcat is not running"    fi  ;;   esac      exit 0  

I don't understand why this is needed in the start of option 2:

ulimit -n 100000  umask 007  

I changed the ownership with chown -Rvh tomcat: /usr/local/tomcat/

Later

# chmod +x /etc/init.d/tomcat  # chkconfig --add tomcat`  

But after restarting the CentOS 6.6, the service is not running.

Testing:

$ echo $JAVA_HOME  $     $ echo $PATH  /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/IntUser/bin  $  

In other words $JAVA_HOME and $PATH aren't assigned!!!

Trying to start manually (I did not assign password to tomcat user, which password should I use?):

$ service tomcat start  Password:   /bin/su: incorrect password  $   

Running as root, I was checking:

# service tomcat start  This account is currently not available.  #   

Checking the account:

# finger tomcat  Login: tomcat                   Name: Tomcat User  Directory: /usr/local/tomcat    Shell: /sbin/nologin  Never logged in.  No mail.  No Plan.  #       # more /etc/passwd | grep tomcat  tomcat:x:493:490:Tomcat User:/usr/local/tomcat:/sbin/nologin  #   

Checking the ownership:

# ls -al /usr/local/tomcat/  total 120  drwxr-xr-x.  9 tomcat tomcat  4096 Jun 27 09:29 .  drwxr-xr-x. 20 root   root    4096 Jun 27 09:29 ..  drwxr-xr-x.  2 tomcat tomcat  4096 Jun 27 09:29 bin  drwxr-xr-x.  3 tomcat tomcat  4096 Jun 27 11:04 conf  drwxr-xr-x.  2 tomcat tomcat  4096 Jun 27 09:29 lib  -rw-r--r--.  1 tomcat tomcat 56977 May 19 15:03 LICENSE  drwxr-xr-x.  2 tomcat tomcat  4096 Jun 27 11:04 logs  -rw-r--r--.  1 tomcat tomcat  1397 May 19 15:03 NOTICE  -rw-r--r--.  1 tomcat tomcat  6741 May 19 15:03 RELEASE-NOTES  -rw-r--r--.  1 tomcat tomcat 16204 May 19 15:03 RUNNING.txt  drwxr-xr-x.  2 tomcat tomcat  4096 Jun 27 09:29 temp  drwxr-xr-x.  7 tomcat tomcat  4096 May 19 15:00 webapps  drwxr-xr-x.  3 tomcat tomcat  4096 Jun 27 11:04 work  #   

Please help me.

Question 1: The script was created in: /etc/init.d/tomcat. Why were $JAVA_HOME and $PATH not assigned?

Question 2 Is there a method to install a service without root privileges, that starts at boot time without intervention (e.g., sudo, su, etc)?

Snort PCAP file analysing doesn't write to alert file

Posted: 13 May 2021 10:00 AM PDT

I'm using snort in my ubuntu 14.04 virtual machine. This is how I installed snort.

sudo apt-get update  sudo apt-get install snort  

I haven't change /etc/snort/snort.conf or rules file. They remain as the default and I did PCAP reading using following command.

sudo /usr/sbin/snort -d -l /var/log/snort -c /etc/snort/snort.conf -r /home/navarathna/Downloads/cap2.pcap  

The PCAP file is successfully read and a snort.log file is created, but the size of that file is 0 bytes. When I installed snort, there was no alert file in /var/log/snort directory. So I created one and gave owner permission for snort as following.

sudo chown snort.snort alert  

After the PCAP reading, both snort.log and alert files have no content (Although the snort.log modified date changes to the last read date and time). Their sizes are 0 bytes. What am I doing wrong here?? Do I need to do some additional changes for rules/snort.conf files?

iotop but for particular disk?

Posted: 13 May 2021 09:29 AM PDT

Is there a tool like iotop but for monitoring IO on specific volumes? (Or perhaps I missed a way to filter iotop?) If not is there any way to get at this information via (say)/proc? (dstat etc. only show aggregate activity across all processes per volume, whereas I'm interested in seeing how much each process is contributing.)

Check if script is started by cron, rather than invoked manually

Posted: 13 May 2021 08:30 AM PDT

Is there any variable that cron sets when it runs a program ? If the script is run by cron, I would like to skip some parts; otherwise invoke those parts.

How can I know if the Bash script is started by cron ?

How to create a testcolor.sh like the following screenshot?

Posted: 13 May 2021 08:22 AM PDT

I found this image on the internet, but don't know how was it made,

enter image description here

Can anyone provide a sample on that? I just would like to have a color table as well.

Non-Root Package Managers

Posted: 13 May 2021 08:45 AM PDT

From my research, I seem to notice that all package managers insist on being used as a privileged user and must be installed into /.

Typically, what I like to do is create a throwaway account, compile some software, and install to $HOME for that account. I can try a variety of setups and then when I'm done, just destroy the account.

However, compiling software becomes tedious.

My experience is really just limited to yum, but I don't understand why I wouldn't be able to drop a repo file into ~/etc/yum.repos.d and have yum install everything into a home account.

Is there any reason why package managers must be used as a privleged user to install software?

No comments:

Post a Comment