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

learn more… | top users | synonyms (1)

8
votes
2answers
637 views

Symbolic link and sudo

I create a symbolic link: ln -s /tmp/folder1 /tmp/folder2 Then I go to /tmp/folder2 and run pwd: $ cd /tmp/folder2/ $ pwd /tmp/folder2 $ sudo pwd /tmp/folder1 # <-- This is the odd part Why ...
0
votes
1answer
239 views

Unable to clear sendmail mqueue-client

drwxr-xr-x 2 smmsp smmsp 4.0K May 6 23:31 mqueue drwxrws--- 2 smmsp smmsp 29M May 8 10:40 mqueue-client As you can see mqueue-client is filled with 29 megabytes of unsent mail. This seems to ...
1
vote
0answers
90 views

Implementing and testing a Subversion hook

Background I'm trying to implement a number of commit hooks for Subversion. I have done a lot of research to try and get a simple test hook to work, however I have had no luck. For reference I have ...
5
votes
2answers
796 views

How to pass input from one script into another using bash

I am writing a script where I am want to launch the mysql_secure_installation script and provide the appropriate answers at each prompt. I tried using echo like this: echo -e ...
1
vote
1answer
95 views

Programmatically adding two lines to crontab

I'm trying to add two lines to the root crontab when building an AWS instance. I have a set of commands that are part of the "user data". These commands are run as root when creating the instance. I ...
5
votes
1answer
589 views

Where is $BASH_ENV usually set?

I have twin Linux servers that should be configured identically, however ssh commands to one of them are failing for commands that require a path that's specified in ~/.bashrc. For example, I can use ...
0
votes
1answer
164 views

change user after ssh and execute multiple commands

I have a simple shell script to login as a normal user, and this normal user has a shell ready to switch into a user that has sudo privileges. However, I can't get it to work: sshpass -p PASS ssh -t ...
1
vote
3answers
371 views

Execute command over SSH while logging live output

I'm trying to log the output of a remote ssh command. I'm current using ssh USER@IP | tee -a ~/random.log and then run the command I need to run on the remote server which then logs to random.log. ...
0
votes
0answers
72 views

SSH chroot solution for Mutt

We have an environment tailored for our users to log in via ssh and instead of gaining access directly to a shell, users have a script in place of a shell. The script simply launches Mutt on the ...
3
votes
1answer
3k views

No such file or directory error when trying to execute startup script in Debian

Very new to Debian (Raspbian), and I'm struggling on this one for a few days. I have a startup script that I want to execute at startup. I have executed the following commands, to make the script ...
5
votes
2answers
223 views

Passing a private key to scp from the command line instead of a file [closed]

Is there a way to pass the contents of a private key directly to the scp command instead of having to copy it to a file and pointing at it via the -i /path/to/key.pem option? So instead of doing: ...
0
votes
3answers
165 views

Bash script: compare paths issue

I'm working on the bash script that iterates over the list of files. I need to compare the paths to this files with the array containing the restricted paths. Inside the for loop I get a path to a ...
2
votes
4answers
368 views

One second delay before tcpdump returns packets

Using Ubuntu, I'm trying to sync tcpdump sniffing with self-identifying "pings" from a client device. The problem is that getting precise starts and stops is made difficult by what looks like a ...
-1
votes
1answer
183 views

Python error when s3cmd is executed within bash script

I'm creating a bash script of which will run on a cron, it's purpose is to backup a directory to Amazon S3 using the s3cmd command. I get the following error when I run the script: /usr/bin/env: ...
3
votes
0answers
186 views

CentOS colors in php-cli applications [closed]

I'm managing a server with CentOS 6.5 x64 installed. In my Ubuntu server, when I run composer or Laravel's artisan php cli command, parameters are colorful. But this doesn't happen when I SSH into ...
1
vote
1answer
97 views

OSX - How can I copy a local users settings/preferences to a new mobile user

We are working on migrating all our local users to mobile accounts that are bound to LDAP. I am working on a script that prompts a user to enter their email and it creates a new mobile user and then ...
0
votes
1answer
694 views

JBoss EAP 6.2 on RHEL 6: ./bin/init.d/jboss-as-standalone.sh hangs while calling via SSH

I'm using jboss-as-standalone.sh to manage JBoss EAP standalone as a service. I can start/stop the service with "service jboss-as-standalone.sh start/stop" while I'm on a terminal. But I would like ...
-2
votes
1answer
158 views

Bash and cron error [duplicate]

The following cron job fails to execute. What's wrong with it? It works fine when I run it directly from the shell prompt. www-data@etl:~$ crontab -l SHELL=/bin/bash MAITO="" 0 5 * * * export ...
0
votes
2answers
389 views

Check if remote mysql query was successful - bash

When using a bash script to execute remote MySQL queries, how can I know if the command was successful or not. Locally it would return an exit code. However, remotely it seems to send the query and ...
0
votes
3answers
77 views

How can I copy all files in one tree to another tree except those matching a pattern?

I have a directory tree under ./src/ I have another matching directory tree under ./work/ I'm trying to copy all the files in src to work, while keeping the directory structure and excluding all ...
0
votes
2answers
153 views

Bash/grep: ignore lines over N characters

I have a find/grep command that i use to search my projects' codebase, thus: find folder1 folder2 folderetc -print | awk '{print "\""$0"\""}' | xargs grep -n "search-string" Something that ...
-1
votes
1answer
58 views

how to set linux hostname based on flashdisk volume label [closed]

i'am running live linux, which run from FAT32 flashdisk since i run a lot of pc using this flashdisk, its difficult to identify which IP for its hostname, since its ip need to be dynamically ...
0
votes
1answer
82 views

Eliminate need for grep use only awk

I am trying to generate a list of PID's to pass to strace I only want the PID's php-fpm. I can get the correct output by using grep with awk but am looking for an awk only answer. Here is what I ...
0
votes
2answers
678 views

Capture piped multiline grep output into a variable

I'm using Zabbix's zabbix_sender.sh script to push exception stack traces to my remote Zabbix monitoring server. zabbix_sender.sh requires a key and a value for any data that it sends. It can read ...
1
vote
3answers
662 views

How do I restore the default bashrc?

I have accidentally overwritten .bashrc. I did the following echo 'export EDITOR=/usr/bin/nano' >> /etc/bashrc Bur I accidentally typed > instead of >>. I guess, it was a bad idea. I ...
1
vote
1answer
77 views

How to programatically find default ssh key?

In most of my experience, by default, ssh will look in ~/.ssh/id_rsa(.pub) for the default key pair. Ocassionally I try to write scripts to take advantage of this default key location, but I end up ...
6
votes
1answer
295 views

Providing normal users(non-root) with initialization and shutdown auto-run capabilities

I'm hosting an experimental/testing Linux box, running Debian Wheezy 7.4.0 distribution. Different users log into the machine over ssh to their accounts and are allowed to run the development tools ...
2
votes
4answers
515 views

Starting a script as another user

I've created a script in /etc/init.d/ which has to run several other scripts from other (non-root privileged) users from their home directories, as if they started them. I launch these scripts ...
0
votes
2answers
83 views

Finding a user's home from bash

I'm trying to get the value of a user's home from a puppet script. This particular user is a Samba user, not a local one, with the username of the form DOMAIN\user. I've tried the following, with no ...
1
vote
3answers
369 views

Batch rename files that end in a dot

I have a large unix fileserver, with a single large SMB share. It serves to Mac, Linux and windows clients. A large portion of the files on this box have been migrated there from a Mac Xserve. One ...
1
vote
1answer
295 views

Get some meaning from apache logs with awk and grep [duplicate]

I am trying to have some meaning from my apache log files: I want to parse my access log and have some statistics about 200 status code hits (how many times each of them was hit). So I tried to learn ...
1
vote
0answers
46 views

SNMPget and bash gives strange results (gauge32 values incorrect)

Reallly strange to me but here is the problem. If I use an SNMP client such as ManageEngineMibBrowser to query the appliance I get what look like reasonable Numbers: dpStatusMemoryStatusUsage.0 97 ...
0
votes
1answer
151 views

How to set ulimit in chroot with --userspec

I have script to create a minimal chroot (below), but I can't figure out how to get ulimit to work on the chroot'ed process: #!/bin/bash user=$1 apps="$2" cmd_to_run="$3" shift 3 ...
0
votes
1answer
44 views

Script to apply Simple Finder restrictions to Mac OS X user?

Is it possible to script (e.g. with AppleScript or bash shell script) applying the Simple Finder and an associated application whitelist to a local user account on Mac OS X? We are using Mac OS X ...
-4
votes
1answer
62 views

Killing a bash sh script [closed]

I made an .sh file load.sh which has (almost) unlimited loop of curl requests. I run this as $ bash load.sh. Now it just keeps running the loop. I can't cancel its execution. It keeps running. I ...
0
votes
2answers
39 views

Creating an environment variable for a specific user

When you set an environment variable in linux is it set only for the user who executes it, or can you specify a user when you store it, or instead is it always available for all users?
1
vote
3answers
124 views

Any Linux tool to create a repo file?

SuSE's package manager zypper is able to create repository file in /etc/zypp/repos.d/. zypper -n rr myrepo zypper -n ar -f http://path/to/myrepo myrepo I'm looking for an equivalent tool do the ...
3
votes
1answer
119 views

Bandwidth Throttling using tc qdiscs

I am trying to limit the bandwidth between a simple iperf server and client, using a third, passive machine acting as a bridge. With no interference, iperf returns a bandwidth of ~90 Mbits/sec. My ...
0
votes
1answer
68 views

Curl pressing enter or ctr+c in order to have the right response [closed]

This is a script that checks my current ip on this site: http://myip.dnsdynamic.org/ and pick the response and calls an API in order to update my dynamic ip. Here the script: curl --user ...
0
votes
0answers
62 views

Wrong PATH in init script on boot

Since the update of the System on my Synology NAS (x86) i have some problems with my startup scripts. The Bash scripts are stored in /usr/local/etc/rc.d. The scripts were executed for sure, because i ...
2
votes
1answer
181 views

Bash: two commands in dollar-parenthesis don't have same behavior

I don't undertsand why, in Bash: echo $(hostname --fqdn) works, echo $(id -un) doesn't (id: –un: No such user). Backticks give the same results. Is there some good practice for using this ...
1
vote
1answer
134 views

Bash script for updating multiple servers not accepting RSA keys

In my environment I manage about 10 Linux servers that require regular package updates. I have a script written to connect to each individually and run the update. Additionally, I have RSA keys ...
0
votes
3answers
117 views

Add an additional check (bash script) to the sshd server

Is it possible to run an additional script during the login process of the sshd daemon/server? I would like to run an additional command that uses the IP address and the username of the attempt. If ...
0
votes
1answer
119 views

Riverbed Stringray TrafficManger - API calls for Autoscaling

I am looking for advice on writing a bash script to put new server that we spin-up in AWS and get them added to our Stingrays. We are creating a new environment in AWS that will be muilt-AZ in AWS ...
0
votes
2answers
68 views

Why does this bash command sometimes return a blank string?

I have the following line to generate a random number: head -c 3 /dev/urandom | hexdump | sed -e 's/[0 a-z]//g' | head -c 1 This works fine but sometimes (very few) it returns a new line. Does ...
1
vote
1answer
493 views

Dovecot quota-warning.sh not being excecuted

I would like to run a custom script with dovecot once the user reaches certain percents of their quota. The issue is that no matter what I try dovecot does not seem to execute my bash script. ...
0
votes
1answer
72 views

Sourcing a config file in bash

I know I can source FILE or . FILE a file in Bash, but for some reason I cannot get it to load in the file. I keep seeing "No such file or directory" errors in the console. Here's the directory ...
1
vote
1answer
88 views

What is the Linux command to get the current PPTP ip address?

I have a Linux script that allows me to route some traffic through a VPN interface, and other traffic (from different IP) through another interface. This is my script: echo "ip route del default via ...
0
votes
1answer
475 views

Alias doesn't work in script with #!/usr/bin/env php

I've some PHP scripts which are starting with #!/usr/bin/env php. The default interpreter is PHP 4.4, but the scripts need PHP 5.3, so I created an alias in ~/.bashrc: alias ...
0
votes
1answer
24 views

prepare domain list to work with squid 3.x

the latest version of squid do not accept duplicated domains like: example.com pre.example.com --- this is no longer necessary and it requires domains to start from "." adding dot is simple: ...