I’m looking to grep a numeric value from a tripwire report, and if the value is greater than 0, send an email. The script so far looks like this: Not sure how to grab the value and set it as a variable or if there’s a way to include it in the if statement itself. Answer First count the entries:
dot dot(..) pathing doesnt work on java new file with linux running jenkins
I have this in a maven build on Jenkins. It’s being used to generate files. It works when building on my local machine(windows 7) but doesn’t work when i run it on Linux. It looks like it’s taking the .. as a literal folder path and not going back a directory. The error is: Answer Using base…
Using register with a loop in Ansible
i want to code a playbook which IF a user exists changes the pw of it. The playbook should be able to take n User’s and change the pw of those Users. At the moment im having the issue that the when is empty due to the loop, i tried using with_items: {{ user_exists.results }} but this is somehow not
Make permanent connection with MySQL (Apache Spark)
If I execute these commands in spark-shell it correctly returns the data in the “people” table: The problem is if I close spark-shell and return it open, the connection to the database is not maintained. Answer As per Spark’s documentation, SparkContext and HiveContext get created inside the…
Find lines starting with “t”, continue with a vowel and total length 4
I have a file with containing 300+ words. I need to find lines starting with “t”, continue with a vowel and total length of 4. Then i need to convert them in to a format where each line have one word. With this I’m able to format the file but i cant figure out how can i select words with
HiveMQ systemctl service not listening to port
I am trying to set up HiveMQ on my Amazon EC2 instance (ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170414) using this guide: http://www.hivemq.com/docs/hivemq/latest/#hivemqdocs_installation_for_specific_operating_systems After installing I can succesfully run HiveMQ using: Change directory to H…
C read() : Invalid arguments
I am trying to read from a nbd device with function read() Here is the code: argv[2] is a nbd device: /dev/nbd0 MSGDEBUG is defined to print __FILE__, __LINE__ and __FUNCTION__ and I got the error msg: Error!!! dedup.c: 554: main read: Invalid argument err: 0 Aborted Am I doing something wrong? Answer read re…
How to install JavaPackage on ubuntu
I came across a debian application by the name JavaPackage which can create a debian installation file (.deb) form a java binary (.tar.gz) which you can then install using dpkg -i application_name.deb. With Ubuntu being a debian-based linux distribution, it is possible that it can be installed on ubuntu as we…
BASH: How to copy the name of the file and insert it into the text using script?
So I need to create a lot of text files. Each of the text file is named AAAAA.txt, BBBBB.txt, CCCCC.txt and etc etc. Within each text file, all the content is as follows: 1.Copy “to-be-replaced”.txt into the folder EXCLUSIVE. 2.Copy the gs file to replace the existing gs file. 3.The .projectdata s…
How to restart a service using sytemd when it crashed based on only certain signals
Basically, I just want to achieve the same functionality as that of init.d’s monitor using systemd I have a service which runs as a daemon. If that service crashes due to some reason, I want to restart it using systemd. When I went through other questions and answers related to this, I found that we can…