The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
2answers
614 views

trap “” HUP v.s Nohup ? How can I run a portion of shell script in nohub mode?

I want to run a shell script over the weekend, but I wanna make sure if the terminal loses the connection, my script won't be terminated. I use nohup for the whole script invokation, but I also want ...
2
votes
2answers
971 views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I ctrl+C the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
2
votes
1answer
85 views

Distributing a custom command line tool to enterprise servers

I've been tasked with building a command line tool that we will be providing to our enterprise customers so that they can use the API to upload data to our platform. The API works with standard cURL ...
2
votes
2answers
2k views

How to set postgresql user password in bash script

I want to set a password for the default Postgresql server user, postgres. I did it by using: sudo -u postgres psql # \password postgres I want to do this step in many machines, so I would like ...
-4
votes
2answers
291 views

Check a list of passwords strength [closed]

Is there any way to check a list of passwords whether they strong or not? I have a list of passwords, around 2000, and want to check them against this policy Password must contain a minimum of ...
-1
votes
2answers
229 views

Simple dig output?

In a script I want to be able to write an IP address to somewhere easily, so I thought using dig (or a similar command) with back-ticks. However the simplest output I've been able to come up to wrt ...
0
votes
3answers
2k views

Command does not execute in crontab while command itself works just fine

I have this script from Colin Johnson on Github - https://github.com/colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup It seems great. I have modified it to send email to myself every ...
0
votes
2answers
448 views

Root crontab not executing script

I have a script listed in my roots crontab 07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log This script contains the following #!/bin/bash echo ...
0
votes
1answer
91 views

solaris + manipulate lltconfig command

I work on Solaris 10 machines (eg de1a and du1b). Regarding the lltconfig command, is it possible to view only one device (eg NIC e1000g0) and not the entire list? For example I want to get only ...
1
vote
1answer
108 views

solaris + match the network device name according to IP address

how to find the device name as ( e1000g2 , e1000g3 , etc ) according to his IP address on Solaris machine for example ifconfig -a | grep 10.106.134.133 inet 10.106.134.133 netmask ...
1
vote
2answers
115 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
271 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
69 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
537 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
143 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 ...
2
votes
2answers
472 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
172 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
163 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
314 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
237 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
180 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
104 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
705 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
229 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
231 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
271 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
148 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
3k 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
154 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
181 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
994 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
308 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
339 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
158 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
132 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
179 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 ...
3
votes
4answers
3k 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
66 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
860 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
182 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
4k 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 ( ...
2
votes
3answers
9k 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
2k 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
430 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
273 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
92 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 ...