Skip to content

Tag: linux

reading file line by line in an infinite loop until break

I’m trying to implement an infinite loop bash script for reading in a file, doing something and check counter condition, when counter condition reaches 0 it breaks out of the infinite loop. I’ve tried several iteration and none has worked for me. Pseudo-code would be something line this.. Can anyo…

How to download multiple links into a folder via wget in linux

When I want to download a file in a folder in Linux via wget I use the following: Now let’s say I want to download several files into the same folder and my urls are: How can I achieve this in one with command in the same folder /patch/to/folder/? Thank you. Answer You can just append more URLs to your

Bind Monit to use Port 443 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 4 years ago. Improve this question I’m using Monit with this config: I can’t change to por…

CALL multiple procedures with python

I have a linux server and I would like to run a python script every day to run mysql procedures but I do not know how to run multiple procedures and put a condition if there is an error that it sends me an email with the description of the error. Here is my script with only one procedure: Thank

Applying ZFS snapshot to a non-ZFS FS

So this is a bit of a question of theory as well as specific (temporary use case) Two servers are to be in sync of each other. One On-Site, the other an Off-Site backup. However, the Off-Site should have the data duplicated and accessible if need be (not storing archive images of server1) server1 and server2 …

Signal Handler Behavior

I have just some questions about the system calls signal, kill and the signal handler. I have this code: 1) I don’t understand why the first printf in the first child, return -1 without a sleep(1) before…seems that the handler is executed after the beginning of the child. 2) When there is a kill t…

using for in loop with sql output

I have a roles.txt file that contains SELECT ROLE_NAME FROM SENTRY_ROLE WHERE ROLE_NAME produces: Im trying to echo all the roles from roles.txt that are not in the sql_output (user in this example). This is what i have so far: Answer That’s not how you iterate over the lines of a file. See http://mywik…

Insert text if column contains a number

I have a tab-delim file that looks like this It should be three columns but some rows are missing the second column (bacterial taxonomy). For these rows I want to move the number to a third column and insert some text (such as Unclassified). I have been attempting to modify some commands I found online to ins…