Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

4
votes
5answers
4k views

Connect to MySQL trough command line without need root password

I'm building a Bash script for some tasks. One of those tasks is create a MySQL DB from within the same bash script. What I'm doing right now is creating two vars: one for store user name and the ...
-3
votes
1answer
70 views

bash + create proccess from function before program ended

the following short bash program described how to execute the func1 by process ( func1 & ) func1 is function that do some tests and verification on Linux machines And this program run after ...
2
votes
5answers
1k views

bash + print line every 10 min in bash

I want to print by echo the following "still in process wait another 10 min" every 10 min Please advice what condition needs to add before the echo command in order to print this line every 10 min? ...
-3
votes
1answer
263 views

how can execute complicated linux command inside perl [closed]

#!/usr/bin/perl @HOSTS = ("192.168.14.112", "192.168.14.90", "192.168.160.1", "192.168.160.100"); my $COUNT = 4; my $date =`date`; for my $myHost (@HOSTS) { **$count = `ping ...
1
vote
2answers
1k views

How to call perl from crontab?

I can run this command fine from the SSH console of my rackservers shared hosting: cd /home/myaccount/public_html/whatever; perl -w -I/home/myaccount/public_html/whatever rss2txt.pl ...
0
votes
2answers
5k views

expect + how to install expect on solaris

subject - install expect on solaris in order to write expect scripts details from my machine: uname -a SunOS 5.10 Generic_139555-08 sun4v sparc SUNW,Netra-T5220 I installed Solaris machine ( ...
3
votes
3answers
18k views

How to run a script automatically on system startup in centos

I've successfully installed TeamCity ib CentOS 6.2 Minimal. I'm stuck on trying to run a script automatically on system startup: /opt/TeamCity/bin/teamcity-server.sh start I've googled around and ...
0
votes
3answers
3k views

Do I need to add 'sudo' for mysqldump command, for the MySql backup script

I am trying to write mysql backup script for cron. Using Ubuntu server. Current code is as below: #!/bin/sh mysqldump -u root --all-databases > /root/all_databases_backup-`date +%A`.sql Do I ...
1
vote
4answers
831 views

Make shell script executable upon extraction from zip

I have a shell file that is pulled from github and built into a zip using TeamCity. It is typically edited and put into github from a Windows machine. I need this shell script to be executable upon ...
0
votes
2answers
430 views

linux + bash + export parameters in to a new file from data file

I have Linux machine red-hat 5.1 and I ask the following question my target is to create new output_file.txt file from answer_file.txt according to data_file.txt as we see here I run first the ...
0
votes
2answers
97 views

grep from file based on the integer value

How can I get details of the page that taking more than 10000 sec. 15:39:22,507NTP=/a/file/fname.pageTime=20559 15:40:10,811NTP=a/file/fname.pageTime=134 15:42:24,488NTP=a/file/fname.pageTime=10153 ...
1
vote
1answer
369 views

Safely execute custom script parts as sudo

In /usr/local/bin I've the following script called sdown /usr/local/bin$ cat sdown #!/bin/bash if [ $# -lt 1 ]; then echo "no time set" else sudo shutdown -h $1 fi Permssions are 788: ...
3
votes
3answers
744 views

Email to run a bash script

I have a bash script to restart a service that runs every 3am to guarantee that the service isn't crashed when users require it. However, I need to provide a simpler way for my partner (that isn't ...
18
votes
1answer
1k views

Shell command slow when using pipe, fast with intermediate file

Does anyone understand this huge difference in processing time, when using an intermediate file, or when using a pipe? I'm converting tiff to pdf using standard tools on a fresh debian squeeze server. ...
2
votes
2answers
179 views

awk + perl + get two arguments in to awk syntax

please advice what wrong with my awk syntax and how to fix it ( this syntax is in my ksh script ) and I run my script on linux machine my target is to get from the file.txt only the lines that ...
-1
votes
3answers
212 views

linux + generate new file with specific structure from text file what the best option

in my Linux machine I have the file orig-file.txt this file include now 4 fields but they could be less or more ( this file generate by other application ) I need advice - what the best option to ...
1
vote
1answer
113 views

tput command + bold specific strings in file

please advice how to bold the "Date & Time" numbers from the following file with tput command ( I have Solaris machine) for example I want to bold only the "24-09-2009 16:17:45" etc for all other ...
2
votes
1answer
219 views

nl command + number each line in a text file only from the third line

I want to number each line in a text file on Linux/solaris by nl command but only from the third line - is it possible ? and if yes please advice how ? for example line1 line2 1 line3 2 line4
3
votes
2answers
1k views

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 ...
0
votes
2answers
718 views

How do I add a line to a specific stanza in a config file?

My configuration file, server.conf, has the following format [general] setting1=sdfdsf setting2=asdfadsf [ssl] setting1=sadfsdf setting2=sdfadsfkljasdf How do I add an additional setting to the ...
0
votes
1answer
192 views

Monitor USB port without physically plugin hard drive

I have to design a program to monitor USB ports of a linux server to detect when an external hard drive is plugged in and removed. Now I have one confusion in my mind about it. I have my own VPS. so ...
-1
votes
1answer
154 views

How to I retain text case while using %h in mt-daapd's config file? [closed]

In my mt-daapd config file is the line name = %h which, if I understand correctly, when my hostname is aCoolHostname this will evaluate to name = acoolhostname in lowercase. How do I use the ...
4
votes
2answers
1k views

Can I change the ownership of all the files of a specific user?

Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux? I assume there must be some magic one liner but my command line wizardry skills are ...
1
vote
1answer
747 views

Script Shrew VPN

I have the Shrew client installed in order to connect to a cisco VPN. (side note: anyconnect royally blows and I spent several hours trying to get it to work; I had shrew running within 2 minutes ...
1
vote
2answers
110 views

Can't pass path to shell script

I'm new to OSX, and don't use the commandline that often. I'm trying to use a script to do some automatic deployment, but when I execute the script it is looking for a directory. I tried: sh ...
1
vote
3answers
755 views

FreeBSD rc.d script doesn't work when starting up

I am trying to write a rc.d script to startup the fastcgi-mono-server4 on FreeBSD when the computer starts up - in order to run it with nginx. The script works when I execute it while being logged in ...
1
vote
5answers
149 views

write in all lines plus one

Can you help me with a unix script to get result like this in file: apple1 apple2 apple3 etc.. till 100 from a file apple.txt which contains only one word - apple. Thank you in advance!
4
votes
3answers
211 views

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 ...
0
votes
1answer
502 views

rc.local is not executed on bootup ubuntu

Im on Ubuntu 10.04. I want to execute script on system boot. I added it to rc.local. If I execute rc.local manually it works fine. If I boot system in recovery mode(2nd string in boot menu) it ...
1
vote
2answers
628 views

How to untar a single file from an archive with randomly generated directory names?

I'm trying write a script that will download a tarball from github and extract a single file from it. However the top level directory inside the tarball has some random characters in it, which I ...
0
votes
2answers
1k views

MySql information_schema error - Lock Tables

I have written a quick shell script to take each backup of MySql database & that works good. I was using the same scripts for all mysql servers tool, I have installed it on ubuntu 10.04 server. ...
0
votes
1answer
53 views

process in the background

I have loop in shell script and it takes time process only a few files in the list. How do I push the process in the background and select the next file while the first file is still being processed? ...
4
votes
2answers
1k views

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 ...
1
vote
4answers
230 views

A script that verifies that Apache (or any account) has proper permission to navigate to a directory

It seems that Apache needs at least read and execute permission to all the sub-directories of a path in order to serve the files in the directory. Does anyone have a script or one-liner that could ...
1
vote
3answers
129 views

Logging with timestamp

I am trying to prepend log entries with a timestamp, but the generated timestamps do not seem to change over time: #!/bin/sh NOW=$(date +"%Y-%m-%d %H:%M:%S") echo "$NOW Logging something" sleep 2 ...
5
votes
1answer
298 views

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 ...
1
vote
5answers
3k views

Silent and scripted install of CPAN and Perl modules?

I need to install CPAN and some Perl modules automatically in a Scientific Linux (RHEL) installation script. Unfortunately the specific modules I want (at least one of them) cannot be found as RPM:s ...
4
votes
2answers
3k views

expect script + expect miss the send string + delay issue

I write the active.ksh script (based on expect) in order to login automatically to some Solaris machine and execute the hostname command (login to virtual IP in order to verify which hostname is the ...
3
votes
2answers
3k views

How do you set a locale non-interactively on Debian/Ubuntu?

Usually, I run aptitude -y install locales then dpkg-reconfigure locales to set up locale. Now I want to put it into a shell script, how can I reliably do the following, automatically / ...
2
votes
2answers
200 views

Tomcat server getting restarted frequently

We have a script like below to monitor our server. During this code our server getting restarted. Can anyone please explain the meaning of below script? if [ -f $HOME/catalinamonitor ]; then echo ...
3
votes
1answer
3k views

Is it possible to set a timeout on openssl's s_client command?

I've got a script which uses openssl's s_client command to pull certificates for a big set of hosts. Some of these hosts will inevitably be unreachable because of a firewall. Is it possible to set ...
1
vote
1answer
177 views

How to verify application up or not?

I would like to write a script to check whethere the application is up or not using unix shell scripts. From googling I found a script wget -O /dev/null -q http://mysite.com, But not sure how this ...
1
vote
1answer
263 views

ssh + multiple ssh connection failed

I have 47 Linux client machines and one Solaris server machine (all Linux client machines are red-hat 5.1) all clients perform ssh connection to the server in order to verify if ...
1
vote
1answer
360 views

Linux shell script - Is it possible to capture the output of a command and use it in another command

So I want to automate the process of uploading a file to Rackspace. Here's what I need to do: First, I type: curl -D - \ -H "X-Auth-Key: 123456789abcdefghijk" \ -H "X-Auth-User: ...
3
votes
1answer
184 views

shell script (KSH) + set file to param & perform test between param and string

in my linux machine red-hat 5.1 - in ppp file - I have only the signature.pl string !!! remark - third application write the signature.pl string in to ppp file I set ppp file in $a param And ...
5
votes
3answers
2k views

“watch” command to notify on newly created files on linux

watch command to notify on newly created files on linux How to modify the below command to notify on creating a new file to /usr/local/mydir/ by linux user john ? watch -d 'ls -l /usr/local/mydir/ | ...
1
vote
2answers
3k views

How can I recursively delete old files and prune resulting empty directories?

We're using an AIX server to house thousands and thousands of little files in a nested directory structure. I'm trying to write a script that will recursively delete old files, and then delete the ...
0
votes
3answers
85 views

shell script + match MAJOR and CRITICAL strings from log file

I need to match lines that have MAJOR and CRITICAL strings that comes after the word ERROR:< any integer number > please advice how to do that with one awk or sed command? more HW_Log.txt ...
2
votes
2answers
524 views

Using Gentoo's `ebegin`, `eend` etc under Ubuntu

We're quite fond of the style of the ebegin, eend, eerror, eindent etc commands used by Portage and other tools on Gentoo. The green-yellow-red bullets and standard layout make for very quick spotting ...
0
votes
2answers
898 views

rsh for windows 7

I am looking for rsh client for windows 7. It should be GNU. I also can't run setup on that machine, so this file must be copied. Reasons: I had a windows XP batch file with rsh commands that ...