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

learn more… | top users | synonyms (1)

-1
votes
2answers
36 views

date +“%s” returning empty string

I have a script with following lines: TIMESTAMP_END=$(date +"%s") FILE=${DIR}/recording_$TIMESTAMP_BEGIN-$TIMESTAMP_END.$EXT mv ${TMP_FILE} ${FILE} Script is running on Raspberry Pi and the ...
-2
votes
0answers
20 views

How to deal with bash errors when trying to run it?

Imagine a script which has standard bash linux scripting (running on SUSE linux). Like this: #!/bin/bash #version=1.0 #Some other text command #-------Comment Changeversion=2.0 ... ... Is there ...
1
vote
1answer
19 views

Interactive App: Make sure certain output is found every 30 minutes

So, due to some very poor design choices I'm stuck with a complex and unreplaceable interactive console application running forever on a Debian machine. This apps does some tasks, repeatedly, and ...
0
votes
1answer
59 views

SSH and sudo over a pseudo-tty terminal

I am trying to overcome some limitations in our environment to write up an authorized SSH file for passwordless ssh keys. I am requiring to perform an ssh as a to a target system, and then run a "...
0
votes
1answer
18 views

Exim script to output the sender and receiver

We have an anti-spam system that sometimes create false-positives. When reported, we verify and whitelist the domains or IPs that have been wrongly triggered. However, I'd like to automate this by ...
1
vote
1answer
30 views

Is there a way to check if my Virtual Memory Paging is “System Managed”

For one of our applications, we need to configure virtual memory on a Windows Machine to be system Managed. This can be done manually under System Properties -> Performance (Settings...) -> ...
0
votes
1answer
17 views

Timestamp comparison on AIX without date -d

I have a bash script on AIX 7 that runs a database query and the output I get is a timestamp in the following format: 201607130319 Now I would like to compare the timestamp with current time(date +%...
1
vote
2answers
108 views

Bash scripting error checking using word count and awk

Need a light on my script I am doing a word count on a variable get a 0 or bigger value but it seems the script is breaking at on this variable function count_check=wc -l $TABLE_CHECKS | awk '{print $...
0
votes
1answer
20 views

Can I filter output from `tail` with the `-f` flag?

I'd like to tail -f the output of access_log on RHEL 6.8 but pipe and grep that output to act as a filter. Is there such an option? That is I'd like live output from: # tail -f error_log | grep <...
1
vote
1answer
21 views

How to make bash treat variables as strings using process substitution

I have the statement: A=$(echo "echo a") && bash -c "awk -v var=\"$A\" 'BEGIN {printf \"%20s\", var}'" Which outputs: echo az And I can't make this one-liner work: A=$(echo "...
5
votes
1answer
148 views

mysqldump via bash script failing with “No such file or directory”

This one's driving me NUTS. Any help appreciated! $MYSQLDUMP --login-path=$HOST $DATABASE > "$BACKUP_DIR/${HOST}__${DATABASE}__${NOW}.sql"; I've confirmed that the binary $MYSQLDUMP (within the ...
0
votes
1answer
9 views

No SQL result output from sql executed from bash

When executing an SQL from a shell like this, the sql result output isn't printed. How do I do it ? mysql -uroot -p < /root/queries.sql Edit: When the content of the sql is a SELECT, I do see ...
0
votes
1answer
58 views

bash script works correctly but skips commands in cron if I am not logged in via ssh or I was connected recently

I am trying to schedule some backup scripts in cron on a CentOS release 6.7 (Final). This is the full backup, basically mounts a remote directory, checks if there is enough space available for doing ...
0
votes
0answers
6 views

Capture all output, error, warning and their appearance order of linux's command [migrated]

In linux we can redirect stdout and stderr or both of them to files. For example: Redirect stdout and stderr to two files: command 1>out 2>err. By this way, we can separate output and error in ...
0
votes
1answer
108 views

How can i recover bash history while i accidentally typed reboot -f

Scenario : After working on my Linux server [CentOS 7] ,I typed reboot -f in my terminal, is it possible to retrieve my bash history after rebooting it? I understand that reboot -f will forcefully ...
0
votes
0answers
20 views

Different behavior of the cron [duplicate]

I have a script (seekCustomers.sh), which perfectly works from the command line: #!/bin/bash echo "Hello" The script is owned by non-root user. I want to put it on schedule using cron daemon. So, ...
0
votes
1answer
17 views

URL encoding issue with cron and wget

I have a simple bash script: #!/bin/bash wget -q 'http://requestb.in/1fq0r3s1?foo=a%2Bb' -O /dev/null If I run this from the commandline and then inspect at http://requestb.in/1fq0r3s1?inspect I ...
0
votes
2answers
68 views

How to filter (out) certain output in bash

I have a process that tails our AWS CloudWatch logs. It works great, except for the fact that every line is prepended by the CloudWatch group and container ID. For example: core-api ...
-1
votes
1answer
37 views

What is the equivalent of chdir for UNIX?

I'm working on OSX 10.11.4 trying to write a simple bash script. I'm getting command not found when I try to use chdir. When I test with which chdir I get nothing. What's going on? I'm using this ...
0
votes
1answer
25 views

linux + get standart output from remote machine

is it possible to get the standard output from remote machine - 100 or 1 , After ruining the script /tmp/script.bash ? ssh $remote_machine /tmp/script.bash echo $? ( from remote machine script - ...
0
votes
2answers
45 views

How to pass variables from one vm to another vm using bash script

What is the proper way to pass variable from one machine to another machine via bash script? In the below code I am trying to get the input from user and want to pass the same to remote machine, but ...
1
vote
1answer
45 views

Can't access apache webserver remotely after connecting to VPN

I have an apache webserver installed on my pc whcih works as expected untill I connect to my VPN service provider (Private Internet Access) using their software. Once connected I'm no longer able to ...
0
votes
1answer
19 views

Adding /etc/environment makes bash fail

On RHEL 6.7, I've added the file /etc/environment: JAVA_HOME="/opt/jdk1.8.0_91" JRE_HOME="{JAVA_HOME}/jre" M2_HOME="/usr/local/apache-maven" M2="{M2_HOME}/bin" PATH="{JAVA_HOME}/bin:{JRE_HOME}/bin:{...
0
votes
0answers
12 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
39 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
97 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
27 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
22 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
20 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
12 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
1answer
22 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
48 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
51 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?
2
votes
2answers
129 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
55 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
96 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
61 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
24 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
43 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
80 views

Configure OpenVPN with many users [closed]

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
89 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
17 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
50 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
41 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
66 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
33 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
39 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
9 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
19 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 | ...