Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
1
vote
3 answers

linux/solaris kill many proccess with one command

Is it possible to kill all find process with one command? I do not want to kill each process as kill -9 25295 , kill -9 11994 , etc.. Rather, what I want is a simple way or command that kill all find process (my target is to perfrom this action on…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
1 answer

perl + sed + remove lines that start with "#"

please advice I have linux and solaris machines, and I need command that work on both OS I use the following perl line in order to remove all lines that start with "#" why perl command not work , remark - need to support also lines that start with…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
1 answer

Tool to correlate logs by timestamp

I have various log files, some with the same format (webserver + webserver SSL), some with different formats and even different timestamps. How can I correlate these log files together in a simple console tool? Bonus question: Some logs might not…
Alex
  • 676
  • 1
  • 14
  • 37
1
vote
2 answers

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 HLRSData Scheduler cd…
Rhyuk
  • 404
  • 2
  • 8
  • 15
1
vote
1 answer

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 ffffff00 broadcast 10.106.134.255 ifconfig with grep…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
2 answers

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 that linux1a and linux1b are exists in the line {…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
1 answer

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 /usr/cti/lib/swp/dir/script2.sh . . but when I want to…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
1 answer

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 would love to turn this into an interactive shell…
Dan
  • 141
  • 1
  • 6
1
vote
1 answer

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 expect_sun_script=`cat << EOF set timeout -1 spawn telnet 0…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
3 answers

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 ./script-A.sh Script-A executes, but throws an undefined…
neorg
  • 123
  • 5
1
vote
1 answer

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 timeout to 60 or 120 in…
haoX
  • 11
  • 1
1
vote
2 answers

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 perfectly & If same script runs via cronjob it's only…
user103373
  • 198
  • 6
  • 19
1
vote
1 answer

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 execute a pg_restore onto a database that resides on…
littleK
  • 129
  • 1
  • 11
1
vote
1 answer

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 -ptest --socket=/data/mysql1/mysql.sock -e 'insert into…
Ahn
  • 181
  • 3
  • 5
  • 13
1
vote
1 answer

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 the mysql service won't restart, I've tried using…
Tyler
  • 77
  • 1
  • 10