Skip to content

Tag: linux

Use environment vars with head

I need to use some vars in a script where I use tail and head, my script works when I type it in the terminal but when it is in a .sh file I get this error from the head command: The error comes from this pipe of my script: I tried using variables in another script where only declaring

linux command to delete the last column of csv

How can I write a linux command to delete the last column of tab-delimited csv? Example input aaa bbb ccc ddd 111 222 333 444 Expected output aaa bbb ccc 111 222 333 Answer It is easy to remove the fist field instead of the last. So we reverse the content, remove the first field, and then revers it again.

Yii2 call the console command not from the project folder

Hello. I created the console command in Yii2: I want to call this command in cron,and for testing I try to call it from the console, when I’m in the project folder: Everything works fine. But, if I call this command when I’m in a different directory, I get some errors. First, i got Seeing this, I …

How to use cron on a simple script

I want to use cron for execute a script periodically. I want to try a simple script first but it does not work. This is my script (scritp.sh) which permission are 700: And this is the crontab file when I edit it with the command crontab -e: EDIT: I have that script on /home/padro/Documents folder. What I do a…

linux find files with optional character in their name

suppose I have two files: ac and abc. I want to find a regex to match both files. Normally I would expect the following regex to work, but it never does: I have tried escaping or not the questionmark, this never seems to work. Normally in the regex documentations I have found; ? means: previous character repe…

Fail event on mdadm

I received this error: This is an automatically generated mail message from mdadm running on host.xx.xx A Fail event had been detected on md device /dev/md2. It could be related to component device /dev/sda2. Faithfully yours, etc. P.S. The /proc/mdstat file currently contains the following: unused devices: T…

Directory: Is a directory

I’ve set up a cron job to run a Python script to scrape some web pages. /etc/crontab However, the emails are informing me that… /bin/bash: /usr/bin: Is a directory When I manually run the script, it pipes data into my database, but when the cron job executes the script, nothing… What does th…