Tagged Questions
0
votes
4answers
126 views
Script runs on 50 servers. How can I ensure only one executes a particular step?
I have some work that needs to be done on 50+ servers. The first step is to checkout an updated version of some source code onto a shared directory (assume all have the shared drive mounted). The ...
0
votes
1answer
34 views
Close a SSH Session when it suspend
I start a ssh session on a remote host and execute a script on the remote host. The Script is an update script that change the remote IP.
Now my local bash script hanging on the line with this ...
1
vote
1answer
33 views
How to not run /etc/profile.d/custom.sh during Secure FTP login
When I attempt to Secure FTP (using WinSCP) to my CentOS 6.4 box I'm prompted with a message that states:
Received too large (168438314 B) SFTP packet. Max supported packet size is 1024000 B.
This ...
0
votes
2answers
74 views
Putting this command into bash script
with help of google , script that measures multicast streams bandwidth.
Here it is
tcpdump -tnn -i eth1 -f multicast | sort | uniq -c | awk '{print $3,"> "$5,$1*$NF/2*8/1024 " Kbps"}' | awk '$1 ...
0
votes
1answer
52 views
How to write a script to install multiple things by just executing it
I have a server (centOS) on which I would like to install the staple development tools. Java, Tomcat, and MySql.
What is a good way to write a script that can be ran on newly spawned server so that ...
0
votes
1answer
74 views
> /dev/tty - What is the purpose of this command?
This is in one of the rc scripts in Red Hat and I want to understand the purpose of > /dev/tty[n]
last=0
for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* ...
-1
votes
1answer
30 views
Can not seem to get expr substr to work
Can anyone tell me what I am doing wrong ?
[ /jlr/sub/libexec/vmr-staging ] $ expr substr "onetwothree" 1 4
expr: syntax error
I got the syntax from http://stackoverflow.com/a/220464/1150847
0
votes
1answer
45 views
Recursively delete empty folders with verbose output
This should be fairly simple, but I am not sure what i'm missing.
I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just ...
0
votes
1answer
56 views
Is it possible to change BIOS settings from Linux?
I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand ...
0
votes
2answers
29 views
get informations from x servers per ssh by bash script
I've server Master,SlaveA,SlaveB,SlaveC, and want to get eg. the space information from the server by executing one bash script on the master.
How can I do that?
--case--
192.168.1.1 - Master
...
1
vote
1answer
52 views
Bash, what does this redirect command do
I have a script that looks something like this:
ruby foo.rb > log.out 2> error.log < /dev/null &
In this case, i understand that STDOUT is redirecting to log.out and that 2> is ...
0
votes
0answers
23 views
How to remove openstack without reimaging
I would like to be able to remove all open-stack components and all config files that were installed without re-imaging the system. I can delete the files and folders manually, but system changes will ...
2
votes
3answers
209 views
Bash script: Monitor hotfolder and partial files
I have a customer that upload files through FTP, I made a script that basically monitor the ftp folder and move the file on a production machine.
How can I check if the file has been completely ...
0
votes
2answers
221 views
Linux command to find and delete certain files, but output the result or verbose mode?
So I use these command on my storage server to clean up some junk, but it doesn't produce any output or result. I found the syntax online somewhere and just modified for which files I need it. What ...
1
vote
2answers
59 views
change user within bash script
I have a simple bash script which runs great as a regular user. When launched from postfix, it runs as nobody:nobody which prevents many commands from working.
Is it possible for the script to ...
0
votes
2answers
214 views
Good pratice to create script to start/stop/restart service?
I was wondering what is a good pratice to create a good script to start/stop/restart some service. I will try to make myself more clear, ok ?
Nowadays, I do something like this: let's say I would like ...
0
votes
1answer
23 views
Omnibus uniform Chef version install across platforms
So I'm looking for a uniform way to install chef on a number of different servers running different platforms. I know I can use the omnibus installer for this, but I also need a way to lock or ...
-3
votes
2answers
213 views
How to find files of certain extension and tar each of them in to another location
I have script for finding files of certain type and compress them to a single tar archive and put in to other place. But now, there is a change in requirement, that I need to find files of certain ...
3
votes
1answer
119 views
echo $? doesn't work when executed remotely
When I execute a command as below it gives me an output as expected but when I run the same command on remote server it always gives me echo $? as 0.
locally
# <some command>
# echo $?
...
0
votes
1answer
92 views
Crontab start a screen
I started a screen by shell script in crontab, when I entered the screen, the left side became "sh-4.1#". While I runed the script directly, it was nomal with "[root@localhost data]".
What happened?
...
1
vote
2answers
54 views
Download with the bash or Python while keeping the directory tree/structure
I have a list of files that I need to download such as
www.domain.com/files/archive.zip
www.domain.com/img/icon.ico
www.domain.com/files/backup/archive.zip
www.domain.com/backup/img/icon.ico
...
0
votes
1answer
62 views
is it possible to provide variable arguments to xinetd service?
I have created a bash script to listen on specific port (using xinetd), so whenever there is someone connecting to port, then it invokes the script and provides its output to user. But i need to ...
-2
votes
1answer
169 views
Which scripting language to use to asynchronously ssh into equipment, run several commands, parse the output, and save to a file on my computer? [closed]
There are several points I'd like to stress in my question.
I'd like to login by asynchronously ssh'ing into our infrastructure equipment. Meaning, I do not want to connect to only one device, do ...
0
votes
1answer
98 views
Why would a process monitoring script use exit 1; on finding no problems?
General question:
On a Linux (Centos) server, if a process monitoring script run by cron is set to close with exit 1; rather than exit 0; on finding that everything is okay and that no action is ...
0
votes
1answer
27 views
Get directory of a symlinked script
I have to determine the directory of a script which is symlinked.
/usr/local/src/myscript/myscript.sh
/usr/local/bin/myscript.sh (Symlink to the one above)
A cronjob executes ...
0
votes
3answers
243 views
When to use Bash, when Python/Perl/Ruby? [closed]
What's your rationale for when to write a Bash script and when to use a more powerful scripting language (Python, Perl, Ruby, ...)?
I'm finding that very simple scripts are nicer with Bash, but many ...
0
votes
2answers
78 views
Call 'script' command and exit it from within a bash script
I'm using the linux 'script' command http://www.linuxcommand.org/man_pages/script1.html to log all input and output in an interactive bash script.
At the moment I have to call the script command, ...
0
votes
1answer
59 views
run script for all users
I put some script on my ubuntu linux in /etc/profile.d/myscript.sh but it's just work on my user.
But it's work only user logged in not when I use sudo.
# myscript.sh
export MYVAL="HELLO"
echo ...
1
vote
1answer
68 views
Script expression to get part of a string?
I'm using the bash shell in CentOS, version ...
$ uname -a
Linux mydomain.com 3.2.29-48.63.amzn1.x86_64 #1 SMP Sat Sep 15 01:43:12 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
In my shell script, I want ...
1
vote
2answers
237 views
How can I easily convert HTML special entities from a standard input stream in Linux?
CentOS
Is there an easy way to convert HTML special entities from a data stream? I'm passing data to a bash script and sometimes that data includes special entities. For example:
"test" ...
-2
votes
3answers
109 views
Determine hostname of connected ethernet switch
I've a bonding on two interfaces. I want to check the switch-redundancy by getting the hostname (or IP) of the switch, which a given interface is connected.
Currently I'm checking this with following ...
3
votes
2answers
113 views
How can I check for a string match AND an empty file in the same if/then bash script statement?
I'm writing a simple bash script to do the following:
1) Check two files (foo1 and foo2).
2) If foo1 is different from foo2 and foo1 NOT blank, send an email.
3) If foo1 is the same as foo2... ...
0
votes
1answer
94 views
Bash and double quotes escaping
If I run some thing like this in shell:
curl -I http://example.com -H "If-None-Match: \"da8e7e-557a9-4cbc6f2e68780\""
I get correct result, but when I'm trying ro tun it in my bash script:
...
0
votes
1answer
125 views
How to make a Bash Script take user input for Changing a Password
The following command on OSX will change an Open Directory (Apple's LDAP) password. The $ is the prompt:
$ dscl -u diradmin -P 'password' /LDAPv3/127.0.0.1 passwd /Users/username newpassword
I ...
0
votes
1answer
127 views
Why does this script stop/fail to continue in Ubuntu 10.04
I have the following script, which works fine until the end of the script where the line to install JRuby 1.7.0.RC2 works, but then the script stops.
I added $? at the end of the script to try to get ...
-3
votes
1answer
65 views
MS Exchange script to summarize emails by title
We have Microsoft Server 2008 64 bit running Exchange 2007 64 bit. We would like to run a script to summarize all emails sent to 3 different email accounts on this exchange server according to a ...
3
votes
2answers
424 views
Backup script to FTP with timed subfolders
I want to make a backup script, that makes a .tar.gz of a folder I define, say fx /root/tekkit/world
This .tar.gz file should then be uploaded to a FTP server, named by the time it was uploaded, ...
0
votes
3answers
353 views
Bash script for mysql backup - error handling
I'm trying to backup a bunch of MyISAM tables in a way that would allow me to rsync/rdiff the backup directory to a remote location. I've came up with a script that dumps only the recently changed ...
0
votes
2answers
94 views
How to clear contents of all the files using find command
Is there an easy step to clear contents of all ".log" file using find command.
Currently i am using "echo -n > filename.log"
i have tried echo -n > /var/application-logs/*.log but it is not ...
0
votes
1answer
221 views
How to rename multiple files by replacing word in file name geting from the shell script variables?
This question like this thread.
How to rename multiple files by replacing word in file name?
My example is more complex than the above topic.
The two variables are $name and $ newname getting from ...
0
votes
2answers
63 views
Pausing deletion of directories if load is high
I have a list of directories that I'd like to delete. However when I do them all at one, load spikes on the box. Does anyone have an example of a script that would wait until load was under a certain ...
1
vote
1answer
49 views
Run command on bash output delimited by space
~]$packageManager list packages
gives back
wordA1 wordB1 wordC1
wordA2 wordB2 wordC2
wordA3 wordB3 wordC3
I then want to run a second command on all B-column words, e.g.
~]$packageManager ...
2
votes
2answers
78 views
Can I find which script outputs which error?
There is a script which calls other scripts and they call others... I don't know exactly which scripts are called and how many of them. I only know that some of them are adding iptables rules and I ...
2
votes
1answer
79 views
Locate devices within a building
The situation:
Our company is spread between two floors in a building. Every employee has a laptop (macbook Air or MacbookPro) and an iPhone. We have static DHCP mappings and DNS resolution so every ...
2
votes
2answers
305 views
How do I redirect output to a single line in Bash?
Let's say we run two programs in the Linux shell, on one line, like this:
who -r; date
What should I add to obtain one line output?
1
vote
1answer
112 views
Some way to “embed” a script to download/delete a file whithin a web server?
I need to make a server work this way:
Check if the requested file exists locally.
if is there, serve it right away
if not, pass the REQUEST_URI to a script which will download it
if the file has ...
1
vote
2answers
260 views
Problems with bash variable expanding with single quotes
I have a variable that I build like this :
ATTSTR=""
for file in $LOCALDIR/*.pdf
do
ATTSTR="${ATTSTR} -a \"${file}\""
done
The variable now contains (notice the whitespaces in the file name) :
...
2
votes
2answers
522 views
How can I add a line break before a set of values going into a bash script?
I've got a set of data piping into a bash script. Here's an example of what that data looks like:
"foo1": "Miscellaneous text",
"foo2": "More text",
"foo3": "blah blah blah",
"foo4": ...
0
votes
3answers
263 views
Symbolically link all JPGs in a directory tree to a single directory [closed]
I have a series of directories, and images contained within:
/Volumes/library/Originals/2012/2012-05-13 Event/filename.jpg
/Volumes/library/Originals/2011/2011-03-11 Event/filename.jpg
...
0
votes
1answer
111 views
Firefox automation script
Some terminals need to be able to automaticaly start Mozilla (or another browser if more convenient) and visit a prespecified page. How is it possible to write a script that runs localy and when ...


