Questions tagged [scripting]

A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

456 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
2answers
111 views

Problem with crontab

My script which starts a process and writes the PID of that process to file. This works as it's supposed to when I execute it from shell: process & echo $! > /home/xxx/PIDs/process.pid But ...
0
votes
1answer
111 views

sed? - replace part of line if match from another file found

I need to take one file containing lines same as this fake one: 232.232.232.256:2001, 232.200.200.256:2314 And i need to run trough another file *.json, and find all occurrences of first "IP" and if ...
0
votes
1answer
62 views

How to run the same command to execute a file in multiple directories?

I want to do the following, I have a set of directories: e.g) 400K 500K 600K and so on In each directory I have a "run.pbs" file, that I want to submit through batch with "qsub run.pbs". I was ...
0
votes
0answers
81 views

Is this segment fault raised when running `shuf`?

I have a script, where there is a line: eval for i in \{"$1".."$2"\}\; do [ ! -e "$3"/\$i.\* ] \&\& echo \"\$i\" \; done \| shuf \| mycommand "$3" which means: first create a sequence of ...
0
votes
1answer
2k views

Creating a config file

I want to create a Bash script that creates config files. I want this file to be able to be called by another script that sets parameters in the config file. (For additional but unrelated info to keep ...
0
votes
1answer
169 views

Shell script which returns elapsed time, memory usage and CPU usage of executed script

I need to write a bash script which will be able to return elapsed time, RAM usage and CPU usage of executed script. my script: #!/bin/bash STARTTIME=$(date +%s%N) #here is script which needs to be ...
0
votes
3answers
117 views

compare two IP address using bc

I am trying to compare two IP address using bc command however the IP with lower numeric value is not being trapped in the test. Here is my code: TEST=$(echo "$i < $IP_BRD && $i > $...
0
votes
1answer
40 views

Fetching title of browser

[Fetching user title] Seen a post prior of someone posting how to do it by single account I wish to do this from the range 1-1000 and have it output to >> .txt Example: x@nine:~# wget -qO- 'http:...
0
votes
1answer
618 views

Converting csv file (generated by db query) to html and color code the table based on Column Value

(Using Shell Script) Need to generate html report from a CSV file which is an output of a DB query and then color code it based on column values. For example, from the given CSV ile, if any cell under ...
0
votes
1answer
338 views

Running commands as different user from bash script

I have 2 users: usr1 and usr2. Neither is a root user. usr1 starts a bash script. And from the script, I want to run some commands as usr2. I understand that the way to do it is: su -l <usr2> ...
0
votes
1answer
39 views

How to run files automatically after I power on my raspberry pi?

Is there anyway to have files (texts/videos) saved in a specific folder to run automatically once I start up my raspberry pi? I am creating a LAN of raspberry pi's with one central laptop connected ...
0
votes
0answers
416 views

usr/lib/sendmail doesn't work

On one of our company server, suddenly /usr/lib/sendmail stopped working. We have a call to it in few scripts (owned and ran by oracle user) and none of them is able to send an email out, even ...
0
votes
2answers
576 views

change date/time format from yyyymmddHHMMss to dd/mm/yyyy HH:MM:ss

How do I change date/time format from yyyymmddHHMMss to dd/mm/yyyy HH:MM:ss which is displayed as an output (eg. JOBNAME1 STARTED AT 20180904152402) from a command... grep JOBNAME1 | sed -e s/|/ /...
0
votes
2answers
36 views

Bash script: parse subdirectory and not current directories

I'm trying to parse subdirectory names, but the output breaks the names up into individual words. Eg. If the subdirectory name is "Hello World", the output will be: . Hello World The ...
0
votes
1answer
163 views

bash script - logrotate output rename

When executing logrotate it shows following: error: error creating output file /var/log/remote/172.29.202.29/contrail-vrouter-agent.log.1: File exists error: error creating output file /var/log/...
0
votes
1answer
29 views

How to use parallel correctly in this situation?

I have a file with multiple URL's in it (separated by a newline) and want to execute a bash command for each line. Here is the command: xargs -n1 -I+ ./info.sh https://+/.info/ +/ How can I execute ...
0
votes
1answer
44 views

The -s argument for the read command messes up the output

So my user adding script again, I noticed that, if I have the -s argument for the read command (when getting the password), the output gets messed up. This is the code again: #!/bin/bash # Only ...
0
votes
0answers
195 views

Matching opening and closing if statements in shell script (if…fi) using PHPStorm, vscode

I hava bunch of these nested if..then...fi 's if [ "${var}" = "NA" ] then if [ "$var" != "SAM" -a "$fileFormat" != "XED" -a "$Format" != "TED" -a "$Format" != "ESTA" ] then ...
0
votes
1answer
411 views

capture output from java

I am trying to do that : #!/bin/bash set out=$(java -jar -Xmx1024m myJava.jar '$1' '$2' '$3' '$4') echo "$out" python myPython.py $out but with no success... I tried with and without quote (because ...
0
votes
1answer
224 views

Cron running script to check line for a comment

WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it. We would run this under cron every 5 ...
0
votes
1answer
142 views

Rename files in bash scripted based on file modified date

It has been awhile since I have had to drive into shell scripting. However, I have a shell script where I'm renaming files based on the file extension from a ftp upload. Currently, the files are ...
0
votes
1answer
377 views

how to compare the runtime input with text file

I want to compare the input and text file word. The text file has: one two three Run time input assigned to a variable var: read -p " enter the value : " var while read first do a=$first if [ ...
0
votes
0answers
175 views

remote process run through ssh gets killed if UI is closed

I have written a script which essentially does 2 things: Runs a UI for listening to the actual program running on the server remotely run the program on the server All goes well, the UI starts, then ...
0
votes
1answer
97 views

Get Variables from Grep Output

I am running a grep command and getting the output below: user@hostname:~$ ps -o args | grep lp_ | grep -v grep | sort -n /usr/local/bin/lp_server -n 5964 -d /dev/usb/lp1 /usr/local/bin/lp_server -n ...
0
votes
1answer
223 views

Dialog menu - Space between menuitems

I want to add a some space between the menuitems of a dialog menu. Is there any way to do it? I created a menu, with "empty Buttons" which call the menu again. This looks like what i want. But the ...
0
votes
0answers
145 views

Linux Script set run level and start before network starts in startup

I am installing a linux script file(SetUpScript) in init.d and setting its run level at minimum priority in every rcX.d(crating symbolic link) by using it like:- #creating symbolic links of ...
0
votes
0answers
23 views

complete RSS truncated feeds

I am looking for a way to locally complete RSS truncated feeds. I was using for years wizardrss[dont click]com (it’s now a squated) witch was an online service who do the stuff. But it turn off since ...
0
votes
0answers
67 views

send carriage return to java application from a shell

I have a script that invoke a java/scala application, this application asks the user several inputs. I want to automatically give the answers to the java app, so I'm creating this script. I have some ...
0
votes
1answer
794 views

Run script at startup as root after everything has finished

I have an IoT device with a barebones Linux distro on it. No crontab, chkconfig, or update-rc. How would I go about running a script when the device has started, after everything on the device has ...
0
votes
2answers
55 views

copy sections of a big file into many output files

I have one large file that looks like: Header1 Subheader1 l1 l1' l1'' Header2 Subheader2 l2 l2' l2'' Headern Subheader n ln ln' ln'' (in which n is ~25K) I need to paste l1-l1'', l2-...
0
votes
1answer
87 views

How can I limit the times a script runs from within tmux?

I have a script which pings a website and tells me how much time I've worked in the week. I want that to be in the status bar in my tmux.conf, but I'm having the issue of the script running about once ...
0
votes
1answer
67 views

SSH <<-MYTAG hiding the script piped into the ssh connection

I'm trying to pass a script on a remotehost without getting the command outputs on the jenkins console. an example script: ssh -o StrictHostKeyChecking=no -t -t update@dispotest bash -s 'hello' <&...
0
votes
1answer
52 views

How can I add * in the middle of the box that is created by this bash script?

How can I add a * into the middle of the box that is created by this bash script? #!/bin/bash # # raami joonistamine echo -n "sisesta ridade arv: " read rida echo -n "sisesta tärnide arv: " read tarn ...
0
votes
3answers
1k views

Grep latest file for string and alert / email if found

I want to grep this string 'FCE-Error' from a folder than contains loads of text based files The folder looks like this -rw-r--r-- 1 root root 0 May 22 10:30 T201805220930.CIR -rw-r--r-- 1 ...
0
votes
0answers
489 views

Polling network range for certain SNMP OIDs

Shell script scan network range for specific SNMP OIDs: #!/bin/bash # snmpget command poll the network range for certain OIDs for (( i=254; $i; i=$i-1 )) do host=10.77.32.$i; snmpget -v ...
0
votes
0answers
48 views

How to make sure filesystem is mounted rw and not corrupt

During the last year I have deployed around 20 embedded systems to various locations. The last month I have encountered that I was not able to SSH into two of them. Upon going to the actual devices ...
0
votes
1answer
76 views

How to use the output of a command as a variable in a script?

I need the following script to look at the running processes on the server to use as the below hard coded variables (orauser and orasid) #!/bin/bash orauser="oraqa1" orasid="ERPQA1" source /home/$...
0
votes
1answer
231 views

deleting helm deployments automatically

I have requirement where I want to delete all pods deployed through helm after a certain amount of time. This process needs to be automated. This is a detail of 3 existing deployed helm instances: ...
0
votes
1answer
448 views

How to run a Java program from an Unix script?

I try to compile a Java project from a Linux script, run_nmc_engine.sh. The problem is that I get an error when launching it : Error: Could not find or load main class caos.aaai.CaosNMCEngine The ...
0
votes
1answer
42 views

Can I script recreation of files such their inodes/mtimes increase in filename order? Across subdirectories?

Long story short, I have a buggy Makefile that is missing a few prerequisite definitions and consequently accidentally relies on the "order" of files on disk (checked out from an SVN repo) as given by ...
0
votes
1answer
21 views

Connect to a shared location username and password from bash file

I have a shared location which requires username and password. On my linux machine I can access it from nautlis by entering the username and password, but when I try to access it from a .sh file as ...
0
votes
0answers
189 views

Shell script to test proxy

I installed an HTTPIE tool on my Linux server to test our proxy for response from sites like google.com and i'm trying to write a script to test if our traffic getting through the proxy or not For ...
0
votes
1answer
109 views

Continuously transfer files to the server

I have linux client and linux server. Both are Ubuntu 16.04. On the client I generated .txt files almost every second, and I want to transfer them to the server, so my question is: what is the best ...
0
votes
1answer
78 views

Monitor Process Output For Scripts

Is there a way to view the console outputs of a particular script that is running in the background on a machine? Maybe using the pid or something similar. For example, to view the output of this ...
0
votes
0answers
26 views

Getting CentOS initialization script from console?

I'm encountering a very weird problem. Last year a friend of mine coded a CentOS initialization script to create proxies. It was working perfectly, but a couple of months ago all my hard drives got ...
0
votes
1answer
42 views

Script to get the weekly tablespace growth

We would get every week db tablespace report, I just want to know how to generate report after comparing last week and this week . Please find the below sample files. Last week report: Tab ...
0
votes
0answers
58 views

How to write a shell script which adds a wildfly management user without interacting with the user?

When I run add-user script(/opt/wildfly/bin/add-user.sh) , it asks for various inputs 1> a. management user, b. application user 2> Username : 3> Password : 4> Are you sure you want to ...
0
votes
0answers
72 views

expect script to automate utility

we want to automate the utility - "Setup ambari-server" this utility ask 4 default questions , and all answers should be default (no) how to use expect script to automate this utility ? ambari-...
0
votes
1answer
59 views

running a executable shell file from a shell file

I'm doing a project where the user runs a .sh file which will then run a executable .sh file. The file is called wifi.sh and then inside this is the file location to fluxion.sh, but when it runs, it ...
0
votes
0answers
24 views

Making a simple script for counting which members of a set have appeared, and outputting probability of appearance of the remaining members

I am creating a simple bash script, but am relatively new to it. Hear me out and the easy (I hope) question will follow. i need to make a script that will take input from the keyboard to know which ...