The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
112 views

ksh + match and verify two strings in single line

how to match the words linux1a and linux1b from single line ? ( should be performed by ksh ) list="solaris1a Auto global linux1a linux1b" echo $list | .... ? my target is to find ...
0
votes
1answer
254 views

SFTP download the files and then i wanted rename the server files how to do this?

I have to setup with the banking interface where I need to connect to the remote bank and then download the files in the bank server in-box to my local server for further processing so i do following ...
1
vote
1answer
67 views

tar + tar not open all files

When I want to view the following tar file , then tar show the following three files from /var/tmp tar tvf fix.tar install.sh /usr/cti/apps/swp/dir/script1.sh ...
0
votes
2answers
485 views

How to hide/masquerade password in script

I use the following script to change Open Directory (Apple's LDAP) passwords. I don't like leaving the actual password within the script -- is there any way to hide or masquerade this so the script ...
0
votes
4answers
138 views

Assigning environment variables for CRON

I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication. The script will run from terminal but it will not when I try to set it up as a ...
1
vote
2answers
437 views

CentOS 6.2 cron.daily

I created a new file "dbbackup" in /etc/cron.daily that contains a simple database backup script. #!/bin/sh mysqldump -h localhost -u user -p'passord' database_name > ...
2
votes
3answers
168 views

bash + how to match string that include characters and numbers

please advice - what's wrong with my syntax ? ( should not print the "bad interface " ) remark - I work with bash shell ETH_NAME=eth0 ( or any other as eth1 or eth2 .... ) echo $ETH_NAME ...
0
votes
1answer
151 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
274 views

expect script + how to perform case in expect script

the following expect script target is to print the hostname name from linux/solaris machine and according to hostname results expect script will run linux.ksh or solaris.ksh script ...
0
votes
1answer
201 views

expect script + write “if” in expect script

please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine ) I want to verify if OS is linux so if it true the expect check if prompt is "#" or ">" and ...
1
vote
2answers
167 views

Different behaviour of script locally and over ssh

I have a script on a server-A Script-A #!/bin/bash -l echo "script-A.sh" | change-environment.sh When I ssh onto server-A and execute it, it works fine. However, when I ssh user@server-A ...
1
vote
1answer
93 views

The plugin of munin is always timed out

I want to use munin to make a graph of ttyACM0 in Linux, but munin can not create the graph. I found some information in "munin-node.log". it shows that "Service 'temperature' timed out". So I changed ...
0
votes
2answers
565 views

Shell Script to Start Mysql Server if not running

I have written a shell script to start mysql server & send a mail to admin user if it's restarted via shell script. What i am facing an issue if I run this shell script on terminal it's work ...
0
votes
3answers
221 views

Files copying between servers by creation time

My bash scripting knowledge is very weak that's why I'm asking help here. What is the most effective bash script according to performance to find and copy files from one LINUX server to another using ...
1
vote
1answer
205 views

Configure Postgres on Server A to pg_restore onto Server B (requiring certificate authentication)

I'm trying to configure a PostgreSQL instance running on SERVER_A to connect to another PostgreSQL instance on SERVER_B. I'm running a shell script on SERVER_A that ultimately needs to connect and ...
0
votes
2answers
246 views

Shell script to fix bad filenames? [closed]

I'm IT at my small firm; and, despite my dire warnings, everyone puts files on the server with awful names, including leading & trailing spaces, bad characters (including \ ; / + . < > - ...
0
votes
2answers
2k views

syntax error near unexpected token `then'

I created bash script wich works as Nagios plugin. Here is a part of it: 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex"|cut -d ':' -f 2|xargs` 45 CURSPEED=`ethtool $IFACE|grep "Speed"|cut -d ':' -f ...
-4
votes
2answers
36 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
137 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
1k 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
2k 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 ...
1
vote
1answer
145 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
170 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
775 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
288 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
288 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
151 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
130 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 ...
5
votes
1answer
178 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 ...
1
vote
4answers
2k 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
65 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
748 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
163 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
938 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
3k 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
2answers
7k 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
1k 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
342 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
242 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
86 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
294 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
562 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 ...
2
votes
2answers
151 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
vote
1answer
91 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
2answers
539 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
408 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
133 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
129 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 ...
2
votes
1answer
351 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
392 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 ...