Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

learn more… | top users | synonyms (1)

0
votes
1answer
10 views

CentOS 6.5 proxy bypass/no_proxy not working

I am running CentOS 6.5 on my desktop. I've set the Network Proxy using the network proxy application provided under Preferences. I've also set the following exceptions: ...
0
votes
2answers
31 views

Run Bash Script Another Server

I want to run command one by one, for change the names of the directories on the server. When I run script, directories renamed in server 1. But, directories are not found in server 2. What the ...
-1
votes
2answers
28 views

Can't pipe echo to netcat?

I have the following command: echo 'HTTP/1.1 200 OK\r\n' | nc -l -p 8000 -c and when I curl localhost:8000 I am not seeing HTTP/1.1 200 .. being printed. I am on mac os x with netcat 0.7.1 Any ...
1
vote
2answers
27 views

Kill all currently running cron jobs

For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command ...
1
vote
2answers
54 views

script to count the occurence of the particular string in the given time interval

We are trying to write a script "sendemail.sh" to count the number of occurrence of a particular string in a log file "SendEmail.log" within the given interval. We have a log file. In that we are ...
-2
votes
1answer
29 views

Bash Script to Compress / Transfer / Remove Log Files [on hold]

I am currently using chronolog to set log file names for Apache with date. They are in the following format: /WEB/LOGS/APACHE_ACCESS_YYYY-MM-DD.log /WEB/LOGS/APACHE_ERROR_YYYY-MM-DD.log I would ...
-2
votes
1answer
29 views

Ubuntu Server running Plesk subversion command only accessible to root user

I have a VPS through myhosting.com the VPS is running Ubuntu 12.04.5 LTS with Plesk 12.x when I log into my VPS with the root user and do svn help I get the standard reply telling me the basics of the ...
1
vote
0answers
49 views

Is there an open source implementation of RFC 2544? [closed]

I've built an open source implementation of RFC 2544 in bash and writing a report on my work I've been asked to list other open source implementations of this RFC. I've searched on Google, on code ...
3
votes
2answers
208 views

Bash convert character in variable

I am writing a collectd nagios custom check script in bash. The problem I am having is that nagios shows hostnames as host.name.domain but collectd holds WSP files as host_name_domain. My question is ...
0
votes
2answers
29 views

Start reading a file's content from line N using BASH

Suppose I have the file temp.txt with the following content: 1 2 3 4 5 6 How would you read the file's content starting from line number 3 using BASH so that the output would be like this: 3 4 5 6 ...
2
votes
2answers
63 views

How to get dig +short to return something when there is no answer?

The behavior of dig +short is to return nothing (null) when running a query that returns no answer (nothing to do with timeout, just an empty answer). This is ok when running a query by itself, but ...
-2
votes
1answer
39 views

Make 'less' behave like 'tail -f' [duplicate]

tail -f does what it's meant to do pretty well, but it's rather limited when some more control is needed, i.e. when stopping/resuming text would be useful. Would it be possible to use less instead of ...
14
votes
5answers
747 views

Piping wget output to /dev/null in cron

I am running the following command every 5 minutes in my crontab to keep Phusion Passenger alive. */5 * * * * wget mysite.com > /dev/null 2>&1 When I run this it performs a wget on the ...
-2
votes
1answer
72 views

Is the Datadog install script safe to run? [closed]

I have a production server (CentOS 6, Apache, Nginx, MySQL, PHP, wordpress). I want to see some metrics (e.g., load bandwidth, RAM, CPU and so on). I chose a Datadog for this task. The instructions ...
1
vote
2answers
298 views

How to bypass sudo

I am trying to script a non-interactive install of Meteor (JS Framework) and part of the script prompts for sudo . I cant seem to get past it w/ my scripting skills. The install is : curl ...
0
votes
2answers
31 views

Can I use rsync to create a list of only changed files?

I am using rsync in a bash script to keep files in sync between a few servers and a NAS. One issue I have run into is trying to generate a list of the files that have changed from the during the ...
3
votes
1answer
27 views

In tar how can I exclude dir contents but leave empty dir

I want to create a tar file excluding certains folders who have many sub-folders and files, but leaving only the main folders that's being excluded. Explaining: -project |-dir1 |-dir2 |-cache ...
-1
votes
0answers
35 views

Append files with bash one-liner? [migrated]

Currently I use multiple lines to append content into a combined file, e.g. ./myprogram 1.txt > Out.txt # Overwrite for the 1st file ./myprogram 2.txt >> Out.txt ./myprogram 3.txt >> ...
-6
votes
1answer
55 views

Get rid of the ubuntu thing that suggests what packages you should install [closed]

I'm finding myself in the unfortunate place of using Ubuntu as a server OS and its tendency to suggest what packages I should install and how to install them when a program I enter in the shell isn't ...
-5
votes
2answers
45 views

Bash Script that downloads a file and checks the value if 1 or 0 [closed]

I need a Bash Script for Debian which downloads a file, that file containts 1 or 0, 1 when the services is running, 0 when not. So how can I check if the file contains 1 or 0?
3
votes
1answer
41 views

a2ensite through shell script

I created a small script to add websites on my server and it looks like this: #!/bin/bash echo "<VirtualHost *:80> ServerAdmin admin@example.com ServerName $1 ServerAlias www.$1 ...
0
votes
1answer
40 views

Where is this bash shell alias being configured?

While logged in as root onto a CentOS 6.5 system, I run ># alias alias cp='cp -i' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias ...
-1
votes
2answers
65 views

Delete all files except the newest of each day

I have dump directory that is filled at the rate of one file per 4 hours. I wish to keep all files for a week then delete all except the newest of each day. Bash is preferred though other solution ...
2
votes
4answers
88 views

Run local script over ssh

silent ssh is setup from server A to server B (and some 500 other servers) I have written a script on server A (shell and perl) that I want to execute via ssh on server B (and the other 500 servers). ...
0
votes
1answer
34 views

Modify the command line that gets saved to history / .bash_history in Linux

When commands are saved to history in Linux, is there some way to prepend the command line in the history with the remote SSH IP address and process ID so that it's easy to group commands from the ...
0
votes
1answer
53 views

run multiple instance of same php script from bash

I am running a cron job to execute a php file multiple times per minute like this * * * * * /usr/bin/php /var/www/html/myFile.php >> /var/www/html/cronlog 2> /dev/null * * * * * ...
1
vote
2answers
52 views

I need to augment my output to include cat-ing a file in this Bash script

I have a script querying a remote server based on user input and looks for the last modified date of a file. It works, however, contained in the file is a string that I need to have displayed as well ...
0
votes
1answer
40 views

How to add a line to a file within a specific section by using a bash script?

I'm writing a bash script which will eventually automate user configuration for Apache. I have this part of the apache configuration (httpd.conf): NameVirtualHost X.X.X.X:80 <VirtualHost *:80> ...
0
votes
0answers
24 views

bash script loses readonly value after first time thru loop [migrated]

I have a bash script which seems to lose the value of the readonly constant after the first time thru the for-in loop. For example: #!/bin/bash readonly DIR="./groups/" for output in "${array[@]}" do ...
0
votes
0answers
12 views

Disabling ssid broadcast programatically/CLI and keeping exsisting devices connected DD-wrt access point

I'm trying to disable/hide my SSID broadcast programatically in order to stop devices connecting to my access point (not for security reasons). I have tried renaming the SSID and setting it to nothing ...
0
votes
0answers
22 views

How to delete all ufw rules for a certain port?

I am using ansible to configure ufw on my DB servers to only let accept connections from certain servers connection to a specific port (lets say 1234). When a server that used to have access is taken ...
1
vote
2answers
116 views

Systemd exits from bash scripts that execute commands that result in failure, instead of continuing

I'm trying to get a script that pushes up my system log on CoreOS to logentries. To compensate for the fact that instances don't have internet connectivity right away when being spun up on AWS I've ...
0
votes
1answer
81 views

Can't run AWS CLI from CRON (credentials)

Trying to run a simple AWS CLI backup script. It loops through lines in an include file, backs those paths up to S3, and dumps output to a log file. When I run this command directly, it runs without ...
1
vote
1answer
46 views

How do I properly escape an rsync exclude pattern used in a bash script?

Script: #!/bin/bash site=$1 remote_host=$2 new_site=${3:-$1} cmd="rsync -rlpuvz -e ssh /www/$site/ $remote_host:/www/$new_site --force --delete --exclude=\"site/web_sitemap_*.xml.gz\"" echo $cmd ...
3
votes
8answers
119 views

list linux partition names only in bash

df on linux lists the following stats on partitions. -bash-4.1# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 1918217320 1473337340 347440136 81% / ...
2
votes
3answers
58 views

Can I use Bash interpreter in service/daemon scripts?

I'm writing a Debian/Ubuntu service that should start on at runlevel 2-5. Most of the existing services I came accross are written using /bin/sh (Shell) interpreter while /bin/bash (Bash) offer lot ...
2
votes
2answers
94 views

/bin/sh: difference between variable and direct command

Imagine i have following bash script: #/bin/sh #next line will work correctly, outputting user name and current directory start-stop-daemon --start --exec /bin/su -- root -c 'whoami; ls' ...
0
votes
1answer
43 views

Binding timestamp value to a variable in crontab

I'm basically trying to declare a variable with a date() value in crontab as I will constantly be using the same date structure over and over, here is what my crontab looks like so far. php = ...
-2
votes
1answer
97 views

Bash script to install packages and report to log file [closed]

I want to be able to log result of running bash script to file. Script itself is pretty simple, its used to install basic packages on fresh install machines and it scheme looks like this sudo apt-get ...
2
votes
1answer
132 views

Bash script match grep output and send message

I am developing a script for monit status checking so I can send OK status messages to NagiOS NSCA server (passive checks). The problem I am having is that my bash script still sends messages if the ...
0
votes
2answers
51 views

Assistance with bash functionality

I need to access data from a server that is behind a proxy. Thus, I can normally ssh to the proxy and then ssh to the destination to perform administration. However, not sure how to achieve this in ...
1
vote
1answer
30 views

BASH: append loop output to an email [closed]

I want the output of this script to be a body of the email message but I don't want to redirect it to a file first and then to an email, basically no external login/output files - all action should be ...
0
votes
7answers
162 views

better way to loop through a list of servers

I regularly do things where I loop through a list of servers to take some action. For example: for s in `cat servers.txt` ; do echo; echo $s ssh $s 'do something' done I'm wondering (from a ...
1
vote
1answer
50 views

rsync not deleting Folders in destination

I know there are some questings with the same topic here but no answers helped me. First, this is my script. It should copy all files from the source to the destination (preserving all rights, etc). ...
0
votes
0answers
24 views

Odd behaviour with varnishlog and stream redirecting

I wrote a helper to debug varnish installation and have used it on both production and development server. The odd thing is, I encountered different behaviour even though the setup is nearly identical ...
0
votes
1answer
35 views

Bash function hangs while command run perfectly without function

Following function hangs : ssh() { local RESULTS; RESULTS=$(ssh $USERNAME@$SERVER $SSH_COMMAND1); echo $RESULTS; } ssh; while if i run following commands they work fine : ...
0
votes
1answer
46 views

Bash — Using a character-based graphical utility to store output

I'm using bash to script a remote dialing program in an Ubuntu(14.04) server and I am having some significant trouble trying to read the output from it. I would like the program to execute as I would ...
0
votes
2answers
92 views

Backup Ubuntu server with cron/rsync: Problems with resuming large files

I currently have a dedicated Ubuntu backup server which wakes itself up from suspend (using rtcwake) daily. 5 minutes later a cron BASH job kicks in, using rsync to pull files from various network ...
-4
votes
2answers
44 views

Linux User generation script [closed]

Was wondering if someone could point me in the right direction. I'm wanting to create a simple bash script to create user account. The script will need to prompt the admin for a username and ...
0
votes
0answers
11 views

Ctrl-C is ignored by pppd when put in a shell script

I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call /usr/sbin/pppd call <peer_name> from the command line, It correctly receives and handles Ctrl+C from ...