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 after it
Tag: sh
Running variable string match against grep search?
I’ve defined the variables here to shorten the logic a little. The wget works fine (downloads the correct file) and grepping for tar.gz works in the wget.log The issue is the match to another file! Basically, if it’s on a blacklist I want it to skip! Answer Use && to test if both of the grep commands succeed I’ve used
Linux – auto restarting with sleep
Current code of mine is I don’t have access to a linux box right now and only way to do my request will be made on the live server and I don’t want to test and jeopardize something, so I would be happy if I could get some help Is this the way it should be if I want my
Inconsistent behavior when replacing substring with tilde “~” in a BASH parameter expansion
I came across some strangely inconsistent behavior in BASH parameter expansions across a few different servers, while trying to write a quick function. On some versions of BASH, to use a tilde in a substring replacement, the tilde must be escaped, or it will be re-expanded to the home directory: while on other systems, it will not be re-expanded, and
Bash script that will read a number from file and run command if number equals or is higher than X value
I would like to have a script that reads a number from a file, and if this number equals or higher a certain value, it will run another command, if not, script will just die, it would be something like this: Thanks for any help. Answer
What’s the meaning of a ! before a command in the shell?
What is the purpose of a shell command (part of a shell script) starting with an exclamation mark? Concrete example: In foo.sh: I know that without the space the exclamation mark is used for history replacements and ! <expression> according to the man page can be used to evaluate “True if expr is false”. But in the example context that
Including a date/time in a file name dumped from psql
I’m planning on running a .sh script that will run periodically through cron on linux. I’m running postgres 8.4 on centos. My script will have something like this in it: I know there are other ways to dump tables into csv files but this is the only one I could use without admin rights. My problem is naming the files.
Using bash, how can I remove the extensions of all files in a specific directory?
I want to keep the files but remove their extensions. The files do not have the same extension to them. My end goal is to remove all their extensions and change them to one single extension of my choice. I have the second part down. My code so far: Answer You don’t need an external command find for this, but
How to add a word at the beginning of each line BUT not when a # is present
Given a file with many ENV variables. Example: DEV.env I know the command sed “s/^/export /g” will add export at the beginning of each line. But I don’t want to do this when the first character is “#”. How can I do with sed? Answer Something like this: Alternatives:
Collect and sum statistics of `strace` commands?
I know that I can runstrace -c ls to collect system call statistics on the ls executable. However, I want to run the command strace -c {some executable here} mulitiple times over different executables, merge the individual results, and then write to a single file. I want to merge the ‘syscall’ and the ‘calls’ columns. So for example, if ls