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

ssh fails to execute remote command when run from cron bash script - works from CLI

I have a script, written in bash, which runs from cron. One of the first things it does is SSH to a remote host and retrieve a list of files in a directory. Everything works fine when run from the command line, but not from cron. The section of…
Kyle Smith
  • 9,683
  • 1
  • 31
  • 32
5
votes
1 answer

How can I replace line #6 in a text file in a bash script?

I have a text file that is generated by 3rd-party software as part of a build process. I want to replace one specific line - in my case, line 6. How can I do this in my bash script? I suspect sed is my friend here but I'm now stumped. I'm using Mac…
Steve McLeod
  • 190
  • 1
  • 1
  • 10
4
votes
2 answers

FreeBSD rc.d script doesn't start as a daemon

I have developed the following script at location /usr/local/etc/rc.d/bluesky #!/bin/sh # PROVIDE: bluesky # REQUIRE: mysql sshd # BEFORE: # KEYWORD: .…
Megidd
  • 241
  • 3
  • 15
4
votes
1 answer

Is there a way to Controle the IDRAC Console through scripts

is there a way to Controle the IDRAC Console through scripts, i.e. say if i am installing OS on Bare Metal Server and i only have IDRAC as a source and want to select the OPtion 1 or 2 or 3, instead of manually pressing/entering 1,2 or 3 is there…
4
votes
3 answers

How do I programmatically convert putty logs to human-readable, searchable files?

Background: I have a Windows 7 workstation and use PuTTY for SSH connectivity to Linux servers with session logging enabled. I previously used the Printable output option but that has the benefit of no escape characters but the drawback of making…
4
votes
2 answers

Can I get an array as an option argument in bash script

I am writing a shell script and wants to pass multiple options in an argument. Is it possible to do that like using getopts? Requirement example: ./shell.sh -d db1 db2 should pass the values db1 and db2 as the values of the -d option.
Ramesh Kumar
  • 1,770
  • 5
  • 19
  • 29
4
votes
1 answer

How to schedule a Cron job for the second to the last day of each month

I want to schedule a task for the second to the last day of each month. I have read this great article about shell scripting the execution. I have also seen that you can use "L" to represent the last day of the month, but I am using CentOS and…
Jon B
  • 149
  • 7
4
votes
1 answer

Script does not run under Domain Administrator

Server running 2003R2. I have a script, which basically sets a variable, which then uses it to name a backup file. I have given the exact script here: echo > "%temp%\tmp.vbs" wscript.echo 10000 * month(now()) ^ + 100 * day(now()) + year(now())-2000…
4
votes
1 answer

Shell script: the child process do not terminate in linux

I have written a shell script to initiate three background process in the same time. In shell script I am trying to wait for all children to finish their job and then the parent job to terminate. But, with some reason I see the the sleeping…
user269867
  • 141
  • 4
4
votes
3 answers

Access windows file system from linux shell script

I want to know, whether is it possible to access the Windows files from a shell script on Linux system ? What i am trying to do is to run a shell script in my Linux system, that will access the files of a remote Windows system, read them and…
shasi kanth
  • 179
  • 1
  • 3
  • 11
4
votes
2 answers

Init script & the green [ OK ]

I am trying to install fast-cgi for nginx on an EC2 instance. I followed the steps explained here, but that is meant for Debian and does not work out of the box for a red-hat based system. I modified the script a bit to look like - #!/bin/bash ###…
Lord Loh.
  • 1,089
  • 3
  • 16
  • 25
4
votes
3 answers

Detect fails in setup script

I wrote a setup script to install my prefered programs and settings after I got a new server. apt-get install git git clone http://me@myvimsetting.github.com .vim ln -s .vimrc .vim/vimrc ... But if something wrong happens during setup, how can I…
Lai Yu-Hsuan
  • 823
  • 1
  • 6
  • 6
4
votes
1 answer

problem executing a bash script with utf8 encoding

I have a bash script encoded in utf8 . Within the script i use sed command using § as a separator . Now when i run execute this script sed complains about the separator. If i use normal char as a separator for ex @ then everything works. I have…
Inv3r53
  • 163
  • 1
  • 8
4
votes
2 answers

Shell script: Find entries in access log with 500 response within a specified date period

Can someone help me with a shell script to figure out the number of 500 HTTP response entries in an access log within a time frame specified?
Quintin Par
  • 4,373
  • 11
  • 49
  • 72
4
votes
1 answer

Move all files to their own folder

Is there any way on a linux box to move every file in a directory into their own sub directory (i.e. make a directory named after it and move it in)?
Agarax
  • 41
  • 1