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
0
votes
3 answers

Connect to cisco switch using shell script

I would like to run a daily script the cleans my switch arp. I enabled SSH on my switch. how do I connect to the switch using a simple shell script? I'm not sure how to provide the SSH password and the enable password. Thanks!! Dotan.
edotan
  • 1,876
  • 13
  • 39
  • 57
0
votes
2 answers

linux + delete duplicate IP's from file

what the best way to remove duplicate IP's from file I use the command: sort file | uniq but I am not sure if this is the best way , maybe I missed something? remark: my file contain two fields example of file 172.17.200.1 3.3.3.3 …
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
1 answer

Hudson kills the process at end of the shell script

Im configuring Hudson to automate deployment process. In shell script I start the server using different user and Im able to see the logs which says server is successfully started and able to access the application. But Once Hudson reaches end of…
Selvakumar P
  • 305
  • 2
  • 8
  • 16
0
votes
2 answers

Recursively delete empty folders with verbose output

This should be fairly simple, but I am not sure what i'm missing. I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just can't print the actions of -excec verbosely.…
kmassada
  • 113
  • 5
0
votes
1 answer

Get Rsync status for output

At the end of a successful rsync job, I get the typical: sent 6022622 bytes received 4751961 bytes 69738.40 bytes/sec total size is 3328464484 speedup is 308.92 I call my rsync job via a shell script and at the end of the script I write to a…
Jason
  • 381
  • 1
  • 7
  • 20
0
votes
1 answer

can't access sourced variables inside Upstart script stanzas

I'm trying to use the variables defined in /etc/environment in an upstart script. I'm able to export the variable to the child process but for some reason I not able to use them in the upstart script stanza itself. This works: script .…
techjacker
  • 133
  • 6
0
votes
4 answers

How to automatically clean up date stamped logs

I have an apache web server with various virtual hosts. Each virtual host logs to date stamped files using cronolog. The result is that I end up with a lot of files like this: ----rw-r-- 1 root root 467894 2013-02-01 13:43…
Thomas
  • 175
  • 3
  • 9
0
votes
2 answers

FreeBSD rc.d scripts do not return to proper shell

My interesting problem is that when running some rc.d scripts they do not actually drop back to the root shell, but leave me at an intermediate shell as the user they're supposed to be running as. A side effect is that the desired service doesn't…
Josh W.
  • 121
  • 6
0
votes
3 answers

Finding the file/script that invoked a process

I do have a high CPU utilization PhP Process. This process in turn seem to invoke mysql and both processes together are using all the CPU cores and RAM using ps aux | grep php , i could get the filename and location. i.e; /usr/bin/php …
Anil Bhat
  • 1
  • 3
0
votes
1 answer

ZSH escaping / file matching pattern

This works from command line: scp -r ^.git b:/home/wopi/blyzics/. when I paste the above line in a script like this: #!/usr/bin/env zsh scp -r ^.git b:/home/wopi/blyzics/. And run it ./deploy.sh I get: ^.git: No such file or directory Why ?
astropanic
  • 307
  • 2
  • 5
  • 18
0
votes
2 answers

Issues in Play framework Server when I start using su deploy -c "play start"

I have play framework server and Im doing Automation using Hudson, When I start the play server using su deploy -c "play start" it's fine the logs are getting updated and server is started. The same command I'm using in shell script which is in…
Selvakumar P
  • 305
  • 2
  • 8
  • 16
0
votes
1 answer

Escaping special characters while sourcing file in bash

I've written a script that sources a bash shell fragment. The shell fragment is supposed to be a kind of configuration file, basically it's a bunch of bash variable. The issue here is when some of those string variable contain characters that should…
0
votes
3 answers

grep + Regular Expressions to match uniq number

My target is to verify if $FILE is a backup file ( backup file ended with xxxx.xx.xx.xx number Example of backup files ls /etc/VRTSvcs/conf/config main.cf.17Dec2012.09.10.14 main.cf.17Dec2012.09.10.23 main.cf.17Dec2012.09.10.31 Example of…
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
2 answers

Configure the UPS apcupsd demon to run a script?

I have a ups connected to a Linux server with a usb cable, i installed apcupsd demon and i was wondering how to instruct it to run a shell script i created when a special condition occurs? i.e. the battery is 25% percent or the time left is 10…
BluesRhythm
  • 308
  • 1
  • 5
  • 13
0
votes
1 answer

linux cron mysqldump: php exec() vs shell script vs direct command in crontab

The system is running CENTOS 5.8, Apache 2.2.3, MySQL 5.0.95, PHP 5.3.3 We run mysqldump daily for a few databases. It's run via a php script called in crontab. They are run at the same time and cause a spike in the server load. So I'm going to…
codewaggle
  • 247
  • 1
  • 4
  • 11