I need to download chart data from poloniex rest client with multiple options using bash only. I tried getopts but couldn’t really find a way to use mutliple options with multiple parameters. here is what I want to achieve having the arguments I need to call wget for c x p times well I am explicitly wri…
Tag: bash
Set docker image username at container creation time?
I have an OpenSuse 42.3 docker image that I’ve configured to run a code. The image has a single user(other than root) called “myuser” that I create during the initial Image generation via the Dockerfile. I have three script files that generate a container from the image based on what operati…
PHP exec() not grabbing output from bash command
i’m trying to get the ouput from a bash command. If I execute the some command directly in the bash, i see the result. But not with PHP exec() function.. This command try to get a video resolution using ffmpeg lib. The video path it’s fine, I triple check that. Thanks! EDIT: screenshot from the ou…
Running a program on many different computers automatically
I am new to scientific computing and am working on a project which involves running many simulations. The infrastructure with which I am provided for this is about 20 different linux machines which all share storage. What I’ve been doing so far is the horrendously inefficient task of ssh’ing into …
Shellscript If statement returns error
I am trying to check if a file is older than 5 minutes and if that is the case I want to call another shell script which sends me a mail. check_file.sh: Error output: 3: ./check_file.sh: [1]: not found Answer Try something like:
rrdtool graph: one graph line plotted incorectly
I’m trying to keep track of the CPU temperature and usage and then create a graph with the values. I used the rrdtool to store and create the graph. Here is the command I used to create: then to insert values: if I query the data, it looks like this: To create the graph I use this: The temperature line
How to have simple and double quotes in a scripted ssh command
I am writing a small bash script and want to execute the following command via ssh Unfortunately this command contains both simple and double quotes so I can’t do What would be the recommended way to solve this issue ? Answer Using a heredoc You can just pass your exact code on the shell’s stdin: …
Checking result of executed command in a Bash script
I want to run my VirtualBox after my I logged in. To do that, I have to check if it’s already running or not. If not, then start the VM. My problem is that I can not put the result of VirtualBox command into a variable in Bash. I’ve created a function to get the exit parameter, but I get
Check if line starts with digit then put those lines in a separate file using Bash
I would like to check in bash if line starts with digit then put those lines in a separate file. I tried ^[[0-9]] but it doesn’t work. Here is the code which I tried: Answer The correct operator to use regex in Bash script is =~. Moreoever you don’t need to double [ in range of characters. Try thi…
/etc/fstab: parse error: ignore entry at line
I have scrip with function: After execution – mount returns me an error: root@xx255rs2sptry000001:~# mount -a mount: /etc/fstab: parse error: ignore entry at line 9. Same error if I’m trying to sed manually: I tried to close variables in “” – but no luck: echo “//$STORAGE_N…