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.

435 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
869 views

Why the output is not written to log from expect script

I am trying to write the output of the netcat command including the command also to a file by logging into remote servers. But it is not writing. What am I missing ? #!/usr/bin/expect -f set user [...
1
vote
1answer
80 views

Possible to deliver centrally configured login scripts on Linux?

In Windows you can assign login scripts to users which run whenever they log into a system which allowing admins to do things like map drives/printers and generally do anything for which there isn't a ...
1
vote
0answers
229 views

Service script and shared libraries

I have the following simple script IPN in CentOS 6.5 in /etc/init.d/ #!/bin/sh # chkconfig: 2345 05 06 cd /root/IPNHost . /etc/rc.d/init.d/functions start() { echo -n $"Starting..." /root/...
1
vote
0answers
82 views

OCR for getting text from an image. Error management

I want to use an OCR program to obtain some text in an image. The text is not black on white so I don't know if it will be possible. wget -q -O image http://4.bp.blogspot.com/-mIE4JlppKMU/T9_mxKR__wI/...
1
vote
1answer
20 views

Automatically find position, from what last command started in tmux

It is common practice in tmux to start some command, then switch to copy mode, scroll to the position, where is this command started and look over the command output. It is difficult to find the ...
1
vote
0answers
195 views

Logrotate or scripting to manipulate log file

I want to make sure that a certain log file gets empty when it reaches a specific size. I first used logrotate since the man page says: It will not modify a log multiple times in one day unless ...
1
vote
0answers
417 views

Hotmail not receiving emails from a script, but works from the server

I have a working mail server running Debian stable, the following elements are working. SPF DKIM rDNS My IP is not listed in any backlist, I used: mxtoolbox.com for all this. My problem: Sending ...
1
vote
0answers
3k views

How to Download the latest file from SFTP server?

I need to first get the data a file was uploaded to the sftp server on, then check whether it was today's date and if so download it else echo "File not found". I would like to do all this using a ...
1
vote
0answers
27 views

Is there a way to run a script right after an account deactivated?

What I want to do is create a temporary user like this useradd -m -e 2009-12-01 -c "Temp Account" tempUser so that when the account expires (like this one would on December 1, 2009), the computer ...
1
vote
0answers
233 views

Maintain screen session when executing shell script on boot

Solved: I solved this problem by introducing a delay before executing the script: @reboot sleep 60; /root/start_server.sh On Ubuntu 14.04, I have a crontab entry set to run on reboot: @reboot /root/...
1
vote
1answer
601 views

Startup script with LSB headers not working correctly (dependency problem)?

I am creating a startup script for my Ubuntu 14.04.1 LTS server. The script need to be run after the Rabbit MQ server. The Rabbit MQ startup script says it provides "rabbitmq-server". So I put this ...
1
vote
0answers
736 views

xdotool random/more natural delay?

For automated testing of some applications, I would like to emulate the users behaviour. I know I can user the xdotool type --delay option, but I would like a more natural delay. The easiest thing ...
1
vote
0answers
1k views

How to see interactive output when running nmap from a bash script?

I'm trying to run nmap from a Bash script, in a way so that when Enter is pressed it should give some output, as happens when running directly from the commandline. When calling a few different nmap ...
1
vote
0answers
222 views

rsstail Not Printing Output

I've installed rsstail 1.8 on my linux box and everything seems to be going smoothly, knock on wood, except for the part where rsstail isn't printing the streams. Running the command, I see that it's ...
1
vote
3answers
108 views

Perl: Inserting at nth position in file

I have content in my file : 123456789 My output is: 1234CC789 Desired Output is: 1234CC56789 I am insert PP at nth position suppose. But when I am inserting any text it is inserting the text at ...
1
vote
1answer
224 views

How to change inode size on EXT2 file

I am running Ubuntu on my MacBook Pro as I need to reformat a hard drive to EXT2 with iNode size of 128 to use for DCP delivery.
1
vote
4answers
81 views

Git updates automatic notification

I'm trying to create a script that will email me if we have any updates for Git. I assume there are several easier/harder ways of doing this. Also, I have noticed that there are no highlighting ...
0
votes
1answer
16 views

WSL distro disappeared after running history | script

I have a Windows Subsystem Linux installation (the distro is Ubuntu). I use it to build a Rails project and deploy branches to the server. Things worked OK for the last year. Today I accidentally run ...
0
votes
0answers
22 views

How to Switch user and run a command as that user?

I wanted to set up a script that switches users and runs that command as that other user. so example sudo su myFavoriteUser && /run/command/as/myFavoriteUser Any help would be appreciated. ...
0
votes
0answers
17 views

Change specific settings with gsettings/dconf key. (archlinux, linux-lts-4.19)

I am trying to change the "custom-command" value for the Tilix terminal emulator in dconf from python3 $HOME/Scripts/memux/main.py to python3 $HOME/.pps/pecan.py, but I can't figure out the format for ...
0
votes
0answers
67 views

how to grouping timestamp and value with awk

i have some complicated log and need grouping by minutes and value. below some sample log : 2019-08-09T19:01:53:594+07:00 - info: {"tag":"request /browse","tagName":{"status":"05","message":"...
0
votes
1answer
97 views

Create bash script for ping

Good evening I would need a script in bash that follows this command: ping -c 4 -i "IP" for 3 times. Each ping must be performed at a distance of 10 minutes and only when it fails all 3 times, it send ...
0
votes
0answers
17 views

how to urlencode curl messages

i have script got error when curl message . i think have some problem with character "space" or other because when i tried skip space , script running normal. this is my script : #!/bin/env bash ...
0
votes
0answers
17 views

suming numbers one by one contained in a file until certain number and printing then

I have a file called temp6.dat with a list of numbers in a column. I want to sum this numbers one by one until the result is >=80 or <=85 and print the numbers from this list starting with the ...
0
votes
0answers
27 views

Getting error while running the shell script

CURRTIME=$(perl -e ' print time(), "\n"') FILETIME=$(cat timestamp.txt ) TIMEDIFF=$(($CURRTIME - $FILETIME)) I need to add 1 second to FILETIME variable, even if there is no entry in timestamp.txt, ...
0
votes
0answers
10 views

Take similarly named fastq files on a folder and amke them input for an script(on pairs)

I have a set of files named like this inside a folder: AM11_BW415_R1.fastq.gz NAM13_BW968_R2.fastq.gz NAM17_AC_Barrie_R1.fastq.gz NAM3_PI648600_R2.fastq.gz NAM7_Glenlea_R1.fastq.gz ...
0
votes
0answers
31 views

How to portably test for a SIGPIPE failure

In a bash script, I have a pipeline of this form /bin/find ... | grep --quiet --max-count=1 . Basically, I am just testing, yes/no, whether /bin/find found anything. Therefore, if /bin/find fails ...
0
votes
0answers
32 views

How can i get the incoming and outgoing traffic from ifconfig?

I am trying to get the incoming and outgoing traffic of my machine from ifconfig...As of my understanding Rx( total number of packets received) and Tx(total number of packets transmitted). But this ...
0
votes
0answers
26 views

Why does fdisk sometimes ask what kind of partition to make and sometimes not?

Today I was trying to write a script for partitioning disks using fdisk (since that seemed like the simplest option). When going through fdisk the first time and pressing n for new partition, the ...
0
votes
0answers
25 views

check file of sftp and return output to log

I need your assistance. I'm trying to finish a script that I've done but it is not working perfectly. here is the script: #!/bin/bash # iclog=log key="keys/cash_prod_key" date=$(date +%Y%m%d) ...
0
votes
0answers
22 views

overwrite DNS domain

We have an enum server that sends all naptr request to an enum provider. The provider only responds back if the domain matches them. We have several domains and I need to intercept the request ...
0
votes
1answer
29 views

csh: Changing path in non-interactive login

I want this: $ ssh nopathcsh@lo 'echo $path' /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games To return this: /usr/bin /bin I have tried changing and ...
0
votes
0answers
14 views

Launch Openbox actions through script or cli

I was wondering if it is possible to run openbox actions, like the ones that can be found on rc.xml like MoveResizeTo , through a console command so I can launch it from terminal or inside a bash ...
0
votes
0answers
19 views

arch linux udev script trigger

I am looking for some support with an issue I have come across today. What I am trying to do: I am trying to use udev rules to trigger a python script which does multiple things including making a ...
0
votes
2answers
58 views

Single text file: Compare the first n characters of each line and the next. If they are equal print the longer of the two in output file

I am using the Ubuntu bash. My file contains paths from a filesystem. E.g. C:\users\username\subfolder\thisismyfile.txt C:\users\username\subfolder\thisismyfileplusadate.txt C:\users\username\...
0
votes
0answers
32 views

Debian 9 stretch - How to prompt user from rc.local script and echo in current terminal

I need to create an easy to go Debian VM for new developers on my team. I run a script on boot with rc.local. This is a small test script : #!/bin/bash exec < /dev/tty1 # Checking if user ...
0
votes
0answers
30 views

run script continuously and check for error

I have written below script and it reads the file and when ever there is any 400* or 500* word it will give me error message, and now I want to add two more functionality to my script. I added the ...
0
votes
1answer
23 views

Trying to parse a string in BASH for [ - _ ]

I have a BASH script that allows a user to specify a jobname. Right now we except everything. We feed this jobname into another executable that can only accept the following formats: job_name, ...
0
votes
1answer
24 views

How to extract Oracle DML (insert,update) queries from a dump file?

Example: $cat data.txt SCN THREAD OPERATION ID OBJECT ID OBJECT NAME REPLICATE OPERATION SQL ------------- ------- ------...
0
votes
1answer
64 views

Correcting a shell script

I have got a section of shell script which was working earlier but now it is giving some different results: MSG= while true do themenu getchar = case $answer in 1) ...
0
votes
1answer
65 views

how to add additional command-line usage scenarios to script?

how can one make this script work with both input usage scenarios below? #1 ./script.sh #2 ./script.sh input.file contents of script.sh for i in *.mp4; do ffmpeg -i "$i" "${i%.*}.mp4 ...
0
votes
0answers
41 views

How do you loop over files inside of loop?

I have a script like this: #!bin/bash for FILE in *.score; do plink2 --pfile Predix_chr22.doseN.new.pgen --psam Predix_chr22.doseN.new.psam --pvar Predix_chr22.doseN.new.pvar --pgen Predix_chr22....
0
votes
0answers
32 views

Repair a corrupted .odp file

I have a corrupted .odp file that cannot open anymore in LibreOffice Impress. There is no back-up available in LibreOffice (.bak file is missing). I was wondering if there are some powerful Linux ...
0
votes
0answers
9 views

UsbFlashDrive.getLabel meaning

reading through the system logs I can see those two messages USBFlashDrive.isMediaPresent - the media is present in the device USBFlashDrive.getLabel - Getting the label for the USB flash memory ...
0
votes
0answers
12 views

restrict cpu usage of chrome in ubuntu mate

I use ubuntu under virtual machine. whenever if i open too many tabs in chrome or firefox, system hangs. I found there are lot of utility to restrict the cpu usage. has anybody have ready made ...
0
votes
0answers
33 views

How can I kill my custom bash 'for loop' function with a keyboard shortcut?

I am trying to kill my custom bashrc function below: xmacroloop () { for (( i=0; i<$1; i++ )) do bash -c 'notify-send "Playing back xmacro_1 on $DISPLAY" ; xmacroplay "$DISPLAY" < ~/.cache/...
0
votes
1answer
31 views

Find string and make it bold in output E-mail

i have below code which check status of some services on linux rhel 7 and send email (output is different service status). i want to make specific string called "up" and or "NOT up" in bold and with ...
0
votes
1answer
55 views

Rename files based on JSON content using jq

I need to make a shell script that uses jq to rename below mp4 file(s). (could have use jasonpipe but didn't know how to install it on mac) File Dowloaded: title1-1000221327.mp4 title1-1000221327....
0
votes
0answers
53 views

How to run Rscript on multiple files to get table of separated outcomes named as original files?

I have written R script which takes a file from the folder. (CSV. files) The total length of the trajectory of a particular object is computed (one number). I have to do this process on all files in ...
0
votes
0answers
34 views

Comparing all combinations of lines within two columns using awk + if statement

I have a file with 11 Columns of data deliminated by a space between each. For each line in column 2, I need to find the closest value in column 9. So below it would take the first entry in column 2 (...