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
2 answers

While loop does not return control

The following shell script works only for first server and does not loop to the next. I tried 0< before the ssh command but it still does not return to the shell script once connected. #!/bin/sh while read IP do ssh root@10.0.0.10 " ssh root@$IP 'ls…
shantanuo
  • 3,579
  • 8
  • 49
  • 66
0
votes
1 answer

Cronjob for a bash script pauses for 2 minutes randomly

I have been running a bash script on CEntOS 5.5 machine that checks replication on a remote mysql server. The script creates a temporary lock file and is scheduled to run in Crontab every minute. But once in a while the cron job goes out of sync -…
0
votes
2 answers

Which open source program is similar to the Linux "dialog" command?

The linux dialog command is a great tool for creating dialog boxes in terminal windows (e.g. in a bash script). However, there is a drawback of dialog which is that the window is always positioned in the center of the screen. In particular I would…
maihabunash
  • 443
  • 1
  • 11
  • 25
0
votes
1 answer

unable to run the script in linux using plink

I'm unable to run a script in linux using plink.exe. I'm using my user x to login and script is under y user, which I need to sudo to y and run it. I was able to at command prompt manually but not through script (for automation). plink.exe -v -t -l…
0
votes
3 answers

Moving files using sftp

I am trying to move files from one location to another on the remote server using sftp below: for i in a b c d do sftp $REMUSR <>$OUT 2>&1 rename $SOURDIR/sample_${i}_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz $REMDIR quit EOM : : done but i…
user68112
  • 1
  • 1
0
votes
3 answers

Bash script: compare paths issue

I'm working on the bash script that iterates over the list of files. I need to compare the paths to this files with the array containing the restricted paths. Inside the for loop I get a path to a file like this: dname="$(dirname "$i")"; This…
Sray
  • 101
  • 3
0
votes
3 answers

Exclude with the find command

I need some help getting the find command to work right in a script working on. I need to be able to exclude some directories. Below I have what I'm doing as a work around. sudo find / ( -name firefox -o -name thunderbird -o -name seamonkey \) -type…
Cyberninja
  • 121
  • 5
0
votes
2 answers

Script for search string inside the file for every one hour

I need to write a script where the particular string(alphanumeric) should be searched inside the file with every hour for whole day. And the search should not contain the previous hour results. Time stamp format inside file is "2014-02-17…
user197719
  • 191
  • 1
  • 4
0
votes
1 answer

How do I write a script that compares folder/symbolic-link names from two diffrent folders?

I need help in writing a script to create symbolic links. Here is a script that I have been running on background. #!/bin/bash SOURCE="/home/$USER/www" DEST="/var/www" while true; do find $SOURCE -maxdepth 1 -type d -not -name "old.**" -exec ln…
Himalay
  • 3
  • 1
  • 5
0
votes
2 answers

redirect command executed along with output shell

I would like to redirect the command executed along with the output to a file. for example: #ls >ls_out.txt ls_out.txt should be something like : ls file1 fil2 Thanks!
kumar
  • 433
  • 3
  • 10
  • 23
0
votes
1 answer

find directories in the current directory, older than 5 days and archive them

This is basic questions. I need to find folders in the current working directory(not recursively) and if they are older than 5 days archive them. zip or tar.gz is fine. I can find the folders with following commands find ./ -maxdepth 1 -type d…
Abdul
  • 85
  • 1
  • 2
  • 9
0
votes
1 answer

using unison options in shell script?

I'm new to unison, and am trying to use its options in a simple shell script, but they seem to be ignored when the script is executed, causing no changes to be synced between the two servers. My shell script: #!/bin/bash # set paths /…
Elijah Paul
  • 557
  • 1
  • 8
  • 19
0
votes
1 answer

Parsing access.log squid proxy

I have logs files, access.log-*, and I need exclude the 'TCP-DENY' (or include only the 'TCP-MISS'). How I parsing, like grep command on linux, access.log file on windows? On linux it is work fine. I need doing it on windows script (bash). Thanks
0
votes
1 answer

disallow file types (shell script wordpress security)

We recently got our servers into SVN which has been great, but this causes a lot of problems when using things like WP Filebase for CMS file management. It's also hard to keep the uploads folder synced, so we would like to turn off SVN for select…
0
votes
1 answer

Solution to start/stop many instances of one application

I have one tool that performs a long-running task. This tool accepts a configuration file. Right now I need to run simultaneously about 15 instances with different configs (using screen for this). All instances should be restarted at the same time…