Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
0
votes
1 answer

Bash script, read from file, increment variable and output to other file

I have a Debian server with many VLANs. All of that vlan started from 1. I need to read from file all IP, and output all of this in other file. All ok, but i have a problem with increment variable. if [ -f /root/ip ]; then for IP_ADD in `grep -v…
0
votes
1 answer

Powershell: a simple script to take a list of commands and append the same cmdlet every time

I have a list of commands I run in a script like this Some-Cmdlet -someswitch | Outfile -filepath .\somefile.txt -append Another-Cmdlet -someswitch | Out-File -filepath .\somefile.txt -append Hello-Cmdlet -someswitch | Out-File -filepath…
Daniel
  • 1,614
  • 9
  • 29
  • 47
0
votes
1 answer

Date format conversion to epoch using gawk ( awk )

I want to convert dates in a file to epoch time. A sample csv looks like this: $ cat test.jtl 2016/09/19 00:31:17.080,238,test1 2016/09/19 00:31:17.154,322,test2 22-Sep-2014 10:32:35.012,222,test3 I have tried the following , but the result…
user376778
  • 9
  • 1
  • 2
0
votes
1 answer

Pass user and group to a shell script on commandline

I ahve a requirement to run a script thats only runnable with a specific user and group. The format of the command is like $PROGRAM_HOME/bin/installService.sh [USER [GROUP]] I tried running the script as $PROGRAM_HOME/bin/installService.sh root…
user_mda
  • 123
  • 5
0
votes
1 answer

Trouble getting duplicity + cron + shell script to play nicely together

I'm not sure if this is more appropriate here or over in Stackexchange so sorry if I got it wrong. I was wondering if I could get some help: So I'm trying to use cron to run my shell script which consists of multiple duplicity calls (so I can back…
IanQ
  • 103
  • 2
0
votes
1 answer

linux + get standart output from remote machine

is it possible to get the standard output from remote machine - 100 or 1 , After ruining the script /tmp/script.bash ? ssh $remote_machine /tmp/script.bash echo $? ( from remote machine script - not from ssh ! ) on remote machine - more…
dandan
  • 1,081
  • 4
  • 13
  • 21
0
votes
2 answers

How to make a shell script recursive?

I have this shell script from ISPConfig: #!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin . /etc/profile umask 022 if [ -f /usr/local/ispconfig/server/lib/php.ini ]; then PHPINIOWNER=`stat -c %U…
Diogo Braga
  • 441
  • 1
  • 8
  • 17
0
votes
1 answer

shell script calls perl script but exits on perl script's completion

I've got a bash script with a while loop that iterates over a list of directories. On each pass, it calls a perl script to do some work. But on the first pass, whether the perl script exits successfully or with an error, the outer shell script…
user214691
  • 11
  • 5
0
votes
1 answer

Extracting From Logs

I want to grep following information from below raw logs: 2016-05-23 11:01:40 [1005583] 1b4ivg-004DZf-GX ** mustafa@hotmail.com F= P= R=dkim_lookuphost T=dkim_remote_smtp H=mx2.hotmail.com [65.54.188.72]:25 I=[IP…
blaCkninJa
  • 151
  • 1
  • 2
  • 8
0
votes
1 answer

shell script for geting mysql user grants details

I am trying to get mysql user grant details and echo it to out file hari=mysql -sN -e "show grants for mysqladm"; echo $hari GRANT ALL PRIVILEGES ON *prod_server_list.txt stage_server_list.txt user_grants1.txt user_grants.txt user_list_temp1.txt…
0
votes
1 answer

Write shell script that listens to a port and executes an action

Could anyone give me directions as for how to write a shell script that constantly listens to a port and when someone/something sends an HTTP request to that port, it executes an action as sudo? I need to restart nginx from another server and SSHing…
Edward Leoni
  • 11
  • 1
  • 2
0
votes
2 answers

script with multiple (more then 100) select options

I've been burning my brains out before finally decided to ask it here. I'm new in linux/bash scripting. So there goes my question: I'm using this little script in order to block certain countries from accessing my server (It's a little webserver on…
0
votes
1 answer

Installing a software in multiple linux machines using shell scripting in one machine

I will login to one Linux instance using ssh - putty and my goal is to install a software (for ex: I need to download oracle and install it) on 5 Linux machines with one shell script when I run that script on one machine software should be installed…
0
votes
1 answer

Convert $no_proxy to gsettings ignore-hosts

In order to use Chrome in Ubuntu and have it respect some hosts in $no_proxy, I need to set those comma-separated values with gsettings set org.gnome.system.proxy ignore-hosts where is formatted like ['localhost',…
user3105453
  • 221
  • 1
  • 2
  • 6
0
votes
1 answer

bash scripts work fine when I run it from command line but not from cron

I have this bash script in runtests.sh file #!/bin/bash cd /Library/WebServer/Documents/protractor_clipboards protractor testscript.js When I do this on terminal ./runtests.sh But when I try to run it from crontab -e file I get this…
user50946
  • 483
  • 2
  • 7
  • 18