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

learn more… | top users | synonyms (1)

0
votes
0answers
6 views

parallize postgres queries with bash and psql?

I'm trying to run a series of postgres functions/stored-procedures that operate on separate tables in parallel using bash + psql as follows: psql -d samples_20160612_0616 -c "select insert_function('...
1
vote
1answer
23 views

systemd service shuts down on its own

I have a problem with this SystemD service: [Unit] Description=RTC Client Services After=rds.service Requires=rds.service [Service] User=USER Group=GROUP PermissionsStartOnly=true RuntimeDirectory=...
0
votes
0answers
28 views

joint two conditions in bash script

I have this conditions in bash script (bin/bash) .sh iptables for mac in `awk -F";" '{print $2}'` file1.txt; do rule 1 done and the second part: for ip in `cat file2.txt`; do if echo $ip | ...
0
votes
0answers
21 views

Install Bash + openSSH on Windows Server 2012

I had to create a Virtual Machine with Windows Server 2012. Now I want to connect to it via OpenSSH and Bash, installing OpenSSH is successful, however when I connect to the server via ssh ...
0
votes
0answers
23 views

If I know the inode of directory, is it possible to recover it after deleting?

More specifically, say I have a directory with lots of files in it. Suppose I know the inode of the directory. Now, if I delete the directory, is it possible to recover the files inside that directory ...
0
votes
1answer
17 views

Systemd don't launch service as intended user

I have this SystemD script: [Unit] Description=RTC Client Services [Service] user=linuxuser WorkingDirectory=/usr/lib/systemd/scripts/ Type=forking ExecStart=/bin/bash rtc_client.sh start ExecStop=/...
0
votes
1answer
11 views

how to stop esxtop gracefully which is running in batch mode?

I am running esxtop in batch mode using the below command: esxtop –b –a –d 10 –n 2000| gzip -9c > perfData.csv.gz This is going to run for a little over 5 hrs, but I want to stop it gracefully ...
0
votes
0answers
11 views

ubuntu script - switching users in script and deleting previous user

On an AWS EC2 Ubuntu Instance I want to run a setup script that creates a new system admin (let's call it deploy) delete the default ubuntu user and continue the setup as the new deploy user. ...
0
votes
0answers
4 views

Grid Engine for program that needs X11 but doesn't require user input [migrated]

I have a bash script that calls an executable (some commercial software) in "batch mode". On the commandline, if X is available the program runs to completion and then quits, but if not the program ...
0
votes
1answer
20 views

shell script calls perl script but exits on perl script's completion

I've got a bash script with a while loop that iterates over a list of directories. On each pass, it calls a perl script to do some work. But on the first pass, whether the perl script exits ...
0
votes
0answers
37 views

How run script after spamc, use args in script and redirect spamc output to sendmail?

I'm trying to perform custom actions after spamassassin. I have working line in postfix master.cf spamassassin unix - n n - - pipe user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender}...
3
votes
1answer
47 views

Determine if Linux OS is booting off a USB

I need to determine (with a bash script) if a Linux OS is booting off a USB. Can we grep some command to find out?
1
vote
2answers
92 views

Docker exec/run shell command nesting

A short introduction to the use case: I am using a docker container to run my go tests using go test ./.... This can be achieved easily using docker exec <container> /bin/sh -c "go test ./..."....
0
votes
1answer
44 views

Check number of connections to webserver port 80 AND 443

As the title says how would one check the number of open connections to a webserver on port 80 and 443? I'm currently using this oneliner to get the number of open connections per ipaddress from port ...
1
vote
1answer
78 views

how to run a shell scripts at every login in Centos

Actually i want to run my shell script at every time when a user login as well as at boot. i have tried using using crontab but it runs only at boot not at every login.so please tell me how to do ...
0
votes
1answer
58 views

Extracting From Logs [closed]

I want to grep following information from below raw logs: 2016-05-23 11:01:40 [1005583] 1b4ivg-004DZf-GX ** mustafa@hotmail.com F=<abbas@DomainName> P=<abbas@DomainName> R=dkim_lookuphost ...
1
vote
1answer
21 views

How to kill a disowned while loop?

So I've done something like this: $ while true; do ssh sysremote -CN; done & disown % In the ps -ef only ssh sysremote -CN is listed. How do I kill the while loop?
-1
votes
2answers
37 views

OpenVPN Variables Passed via Script

Can someone explain and/or direct me to a summary of the variables that are available to be passed to OpenVPN upon a client connection? For example, what do the following $1, $2, $3, $4 values ...
-2
votes
2answers
78 views

Configure OpenVPN with many users [on hold]

Similar to this question I am looking at connecting 1000's of concurrent users: OpenVPN performance: how many concurrent clients are possible? To save CPU cycles I would like to know if there is ...
0
votes
0answers
23 views

Add Filters to Users

I am running OpenVPN on Ubuntu 14.04 (dev tun) and I can't seem to get my learn-address script to run below I would like to run the learn-address script each time a user connects to OpenVPN that ...
1
vote
0answers
52 views

Bash: Running a background service for the duration of another process

I am running some automated scripts. For some tasks I sometimes need a ephemral background "service" to run. For example, I want to setup an ssh tunnel, run a test, and then have the tunnel removed. ...
0
votes
2answers
15 views

How to direct errors from with a find exec command to a log file

Hi I have the following command that does yui optimizations and runs as a cron job. I want to log the output of the command to a log file. find . -type d -exec bash -c "cd '{}' && pwd &&...
0
votes
0answers
29 views

Is it possible to tab through the commandline history for a particular command? [migrated]

For example, can I see all the previous parameters I passed to the command ssh (i.e. all the server addresses I passed as a parameter when calling ssh)? This is going to be something similar to the '...
0
votes
0answers
46 views

IP not showing in /var/log/secure under rhost

I'm trying to get Fail2Ban to block failed sudo -i commands, but the IP is not showing up in the logs. For example when I log into the server with: ssh -i ~/.ssh/id_rsa USER@1.2.3.4 I then use: ...
-1
votes
1answer
30 views

Monit not able to start program in screen

I have monit able to watch the program but the start script is not working. The stop script works just fine. The when monit tries to start it, it just says execution failed. Monit part check ...
0
votes
1answer
64 views

Bash Script Not Working

I hope this is an easy answer Problems: I placed the following bash script called learn-address.sh in the following folder: vi /etc/openvpn/netem/learn-address.sh Added the following (2) ...
0
votes
2answers
32 views

bash: splitting stdin to multiple processes,merging outputs, ensuring known completion/output order

Consider the following simplified version of a function that converts column data spat out by a terminal program into JSON... side note: the second example might be quicker to read, to understand my ...
0
votes
1answer
30 views

Creating a RFC 1123 compliant date for HTTP header creation on the CLI

I'm trying to create a HTTP 1/1 compliant date header using standard unix date(1) in order to post this to a RESTful server using curl or similar. Any ideas what format to pass to date(1) to get this ...
0
votes
0answers
8 views

Check files since latest git fetch/git pull

When command git fetch --tags --progress ssh://mygit/repos/repo.git +refs/heads/*:refs/remotes/origin/* is done, there is a following output detected: remote: Counting objects: 21, done. remote: ...
0
votes
1answer
18 views

Bash remove exact matching variables and search for string ignoring case

First Query: i have a text file username.txt contains user1 user2 user3 My Bash file is as follows > test.sh #!/bin/bash # REMOVE user which donot have any COMBLIMIT num=0 cat /tmp/username.txt | ...
1
vote
1answer
23 views

xinetd read post data

I'm trying to write a simple handler for a webhook using xinetd and bash. I have the trivial case working with this config for xinetd: service github-hooks { port = 61000 ...
0
votes
0answers
19 views

Find Unknown Predicate JailedShell

Well, after months experimenting with ', ", and \" it seems i cant find the right pattern that could generate the correct code for a cron job on a jailed shell. I got this code below works on jailed ...
1
vote
3answers
72 views

Error when passing string to scp in for loop

I'm grabbing file list from server via find via ssh for f in `ssh -p ${SSH_PORT} -l ${SSH_USER} ${SSH_HOST} -t "find ${DIR_REMOTE} -type f | grep jpg" 2> /dev/null` When I echo the list in the ...
0
votes
1answer
27 views

Globbing based on current directory

Ran into some strange behavior today. Wondering if anyone here can tell me what is behaving differently. Environment is a RHEL 6.7 server. I run the following command: yum list installed *mysql* If ...
0
votes
1answer
68 views

ps aux | grep result depends on terminal size on FreeBSD

From experimenting, it seems that even when using ps aux | grep ... the output depends on the terminal size. This seems seriously weird for me. Isn't a pipe supposed to make command's output behave ...
1
vote
1answer
27 views

How to test if a mounted share is still functional

I have a set of linux machines with samba ( and other ) shared drives. There are automated scripts that mount these shares. My problem is, sometimes a host machine will go offline, but I can't find a ...
1
vote
1answer
28 views

Loading Blacklist of IPs from a file into IPTABLES

In a separate file I'm creating a list of IP addresses to be blocked. This file will have IPs added in or removed on a daily basis. I want to "reference" this IP File into /etc/sysconfig/iptables, but ...
4
votes
1answer
62 views

openldap user can't login when using tcsh

I would appreciate any help in the following problem: I have an openladp (2.3.39) server (Fedora 8) which authenticates users from other ldap clients (various versions of Fedora). On my attempt to ...
8
votes
4answers
255 views

Bash one-liner to atomically create a file if it doesn't exist

I want a Bash one-liner that atomically creates a file if it doesn't exist. That means essentially "if file doesn't exist, create it" but ensuring that no one else manages to create the file in the ...
1
vote
3answers
34 views

Calculating the percentage of the total available memory on linux as an integer in bash

Here is a bash script that is calculating 80% of the total RAM available as an integer on a Linux box: server_ram_mb=$(awk '/MemTotal/ {printf( "%.2f\n", $2 / 1024)}' /proc/meminfo) echo "($...
1
vote
1answer
51 views

ZFS Send Script works when run manually but not in Cron (Already tried common solutions)

Script on sending end is as follows: #!/bin/sh #Variables bigdata=vid-zfs-live/bigdata today=`gdate +%m-%d-%y` yesterday=`gdate -d'yesterday' +%m-%d-%y` #Actions zfs snapshot -r "$bigdata"@"$...
-1
votes
2answers
42 views

Script to delete older files and copy what is left

We have a server that runs an application that is used internally. The application has a utility that creates its own backups every 24 hours. Backups are stored in: /var/application/application-data/...
2
votes
2answers
309 views

How can I set the root password in a docker container from a script?

I have a script that runs on the host and creates/starts/stops a docker container. I'd like the script to change the password of the root user within the container. Since the container is an ssh ...
-2
votes
1answer
50 views

SAVE IP ROUTE RULES AFTER REBOOT

I have two internet connections from two different ISPs and I need to balance & failover the traffic originating to and from my network between the two ISPs. My settings: FIRST ISP (eth0): 152....
1
vote
2answers
34 views

How to run ./configure from a different folder?

I'm writing an ansible playbook which is supposed to compile from source some tool and install it. While checking my playbook, I've tried running the relevant commands manually to check their output. ...
3
votes
2answers
102 views

Allowing PHP to run specific bash script with root permissions

I have a php script calling a bash script like this: <?php $result = exec('sudo /bin/bash /var/www/my_bash_script.sh /var/www/vhosts/testsite/htdocs/'); var_dump($result); ?> This is ...
1
vote
0answers
32 views

Why my profile looks for /usr/local/etc/profile.global (NIS)

My Ubuntu ID is manged by NIS/yellowpage. For some reason, when I log in, I'm getting this message. cat@local:~$ ssh catserver cat@catserver's password: Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-25-...
0
votes
1answer
36 views

Log all bash actions with multiple scripts

Using the command below, I can log all actions that happened inside that script. bash -x script.sh Sadly, the script calls another script, which does not have the -x setting active then, i.e. the ...