Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

0
votes
2answers
1k views

How do I parse a log file for one hour with a simple shell script? [closed]

How do I parse a log file using only a shell script, for last one hour? Each hour, the script should execute, parse the previous hour's logs, and the already alerted or listed errors should not ...
-4
votes
2answers
37 views

list the identical words from fiel [closed]

how can I list the identical words from below file using shell script ? list.txt LT R LT MRTD LT MK RR RR example result : LT R MRTD MK RR
-3
votes
2answers
167 views

Split List of ids in to integer and string? [closed]

I am having a list of ids (total 2 lakh), I want to write a shell script to split the ids (string and integer) using shell script . Example given below : IDlist.txt: | LT345 | | R567 | ...
0
votes
2answers
2k views

How to avoid syntax error on missing command line arguments?

How to avoid syntax error on missing command line arguments? Example shell script: var1=$1; var2=$2; echo $var1 echo $var2 var3=`expr $var1 + $var2`; echo $var3 Output : shell>sh ...
1
vote
3answers
6k views

Powershell Parameters

I have a Param block in my script Param ( [Parameter(Mandatory=$True)] [string]$FileLocation, [Parameter(Mandatory=$True)] [string]$password = Read-Host "Type the password you would ...
2
votes
1answer
260 views

Stream tar.gz file from FTP server

Here is the situation: I have a tar.gz file on a FTP server which can contain an arbitrary number of files. Now what I'm trying to accomplish is have this file streamed and uploaded to HDFS through a ...
0
votes
3answers
326 views

How to join a variable number of lines

I have a file with Feature names and a variable number of usernames below: Feature1 user1 user2 Feature2 user3 I'd like to be able to move the usernames to the same line as the Feature name ...
0
votes
1answer
3k views

mysql -e option with variable data - Pass the variable value to insert sql statement in shell script

The following shell script is not inserting the data to the table. How to pass the variable value to insert sql statement in a shell script. id=0 while true do id=`expr $id + 1`; mysql -u root ...
-1
votes
1answer
452 views

linux + print message on the screen after login to linux machine

I have linux machine red-hat 5.1 I want to write ksh/bash script that perform the following Each time that someone login to the linux machine then he will get the following message on the screen ...
1
vote
1answer
503 views

Can't restart mysql from cron job

I have a problem where MySQL (running on Ubuntu 12.04 with all latest updates) dies after a few days so put this script into a cron job that runs as root every 60 seconds. Everything works except ...
2
votes
1answer
207 views

shell variable value not storing inside file

I wrote following script, which generate random password and store it in file pass1=</dev/urandom tr -dc _A-Z-a-z-0-9|head -c8 echo $pass1 echo "$pass1" >/tmp/a Above script printing ...
1
vote
4answers
144 views

How to execute shell scrips without creating files

How is it possible to execute a shell script without creating a file? For example assume I have the following script (testscript): #!/bin/bash function run_free() { free -m } run_free I then of ...
6
votes
1answer
217 views

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 ...
5
votes
5answers
5k 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
2k 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
284 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
6k 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
23k 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
974 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
459 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
378 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
797 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
2k 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
184 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
236 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
126 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
235 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
2k 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
817 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
202 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
158 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
2k 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
852 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
113 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
817 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
214 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
523 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
680 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
242 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
130 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
355 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 ...