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
6
votes
1 answer

Is it possible to listen to a TCP port only with a shell, with no additional tools?

I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port. The problem is that the system doesn't have even perl. Only some basic shell…
d.k
  • 285
  • 2
  • 9
6
votes
4 answers

Incrond running but not executing commands CentOS 6.4

I have copied this question over here from StackOverflow... I have installed incron from the EPEL repository (0.5.9) (before you ask; YES, I also tried downloading the source and compiling locally (0.5.10); same results) and am attempting to set up…
JawzX
  • 91
  • 1
  • 1
  • 7
6
votes
1 answer

identifying ssh trusts between multiple servers on a network

The problem: We have many dev/qa/prod RH/Solaris servers with many accounts having ssh trust between them, including between servers in different environments (prod->prod, but also qa->prod). I know this is a bad practice, and the first step I'm…
Alex
  • 161
  • 4
6
votes
1 answer

perl equivalent of sh -e

In /bin/sh and /bin/bash (and I guess a lot of other shells), starting scripts with #!/bin/sh -e (or executing set -e in someplace in the script) would cause the script to abort when any command line inside the script exits with a status code…
Carlos Campderrós
  • 773
  • 2
  • 6
  • 17
6
votes
2 answers

Linux FTP upload: "No such file or directory", but file exists

I want to upload backup archives from one server to another server using ftp. In my backup cronjob I use this script to upload files: MEDIAFILE=/var/somedir/somefile.encrypted if [ -r $MEDIAFILE ] # File seems to exist and is readable then ftp -n…
i.amniels
  • 325
  • 1
  • 4
  • 9
6
votes
3 answers

Returning A List Of Quoted Files Paths Using Find

I would like to create a tarball that contains files from a directory that have a ctime of less than 30 days. Most tutorials I have found have basically recommended doing something like this: tar cvf foo.tar $(find ~/POD -type f -ctime -30) The…
Tom Purl
  • 549
  • 1
  • 3
  • 13
6
votes
4 answers

Robust way to resolve a DNS address in a script (IPv4 (A) and IPv6 (AAAA))?

I have a domain name in a bash variable ($TARGET), and I want to get the IPv4 (A record) address of it in my bash script (I also want to get the IPv6 AAAA record (if exists)), in a robust manner. i.e. What bash/unix command will: (i) print the IP…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
6
votes
3 answers

How to delete docker images older than x days from docker hub using a shell script

How to delete docker images from docker hub using a shell script. I want to delete all images from docker hub older than past 50 days of a private docker hub account. Any ideas? Which tools to use while creating and running this shell script from…
amit
  • 91
  • 1
  • 5
5
votes
1 answer

Closing All Shared Files on the Network

I am trying to close all of the open files in the shared folders of a server via PowerShell script. I found the following script which only close files on one drive (F:), however, this server has 3 drives (F:\, G:\, H:) which I want to close all.…
eccoripo
  • 53
  • 1
  • 3
5
votes
2 answers

Installing and configuring phpmyadmin completely through a shell script

Referencing this tutorial: https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-ubuntu-14-04/ for installing PHP-Admin, after installing the package, on "Step 2: Basic Configuration" some questions need to be filled out by the…
Rodrigo
  • 51
  • 1
  • 3
5
votes
2 answers

How properly handle deletion of pid.file in service script

I'm trying to write service script for application. So I can control it like this: ./myscript.sh start|stop|status On startup pid.file with process id creates, and based on it I can check status and stop process. In stop command I remove pid.file -…
zella
  • 153
  • 1
  • 1
  • 5
5
votes
2 answers

linux + how to identify if file is pointed by link/s

I create new file called - 192.9.200.1 touch 192.9.200.1 then I create new link that will be pointed to 192.9.200.1 file ln -s 192.9.200.1 file so finally I get: ls -ltr /tmp -rw-r--r-- 1 root root 0 May 8 19:39…
yael
  • 2,433
  • 5
  • 31
  • 43
5
votes
3 answers

Simple dig output?

In a script I want to be able to write an IP address to somewhere easily, so I thought using dig (or a similar command) with back-ticks. However the simplest output I've been able to come up to wrt dig parameters is > dig -t A +noall +answer…
knocte
  • 347
  • 1
  • 6
  • 18
5
votes
2 answers

expect + how to identify if expect break because time out?

The target of the following simple expect script is to get the hostname name on the remote machine Sometimes expect script fail to perform ssh to $IP_ADDRESS ( because remote machine not active , etc ) so in this case the expect script will break…
Eytan
  • 611
  • 6
  • 13
  • 27
5
votes
3 answers

Bash-Scripting - Munin Plugin don't work

i have written a munin-plugin to count the http-statuscodes of lighttpd. The script: #!/bin/bash ###################################### # Munin-Script: Lighttpd-Statuscodes # ###################################### ##Config # path to lighttpd…
Arny80Hexa
  • 139
  • 1
  • 4
  • 14
1 2
3
41 42