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

learn more… | top users | synonyms (1)

-1
votes
0answers
3 views

oSX 10.11 running on vmware player sudo mount error on mount() =-1 error on sudo [on hold]

I have oSX 10.11 running on vmware player and I am trying to make it full screen. I am following this tutorial here: https://www.youtube.com/watch?v=46GL3YW-r50 However I am having this error:
-1
votes
0answers
8 views

configure: error:UPnP code has been disabled, Could not find crypto++ header file

I use Centos 6 (6.7)I want correct this command (is wrong) [root@ultimi aMule-2.3.1]# ./configure --prefix=/usr --with-denoise-level=4 --enable-optimize --disable-debug --enable-cas --enable-wxcas ...
0
votes
1answer
47 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
29 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
16 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
6 views

When did bash's shopt huponexit start defaulting to off? [migrated]

On Monday morning, I logged into a box with ssh and ran the following command: tail -f /var/log/foo/bar.log | grep something_interesting & At some point later in the day, I logged out by ...
0
votes
0answers
7 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
13 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
votes
0answers
24 views

how to fill the cpu cache forcefully

Is there a simple (bash based) way to forcefully fill up the cpu cache on linux with some dummy contents? I am comparing the timings of two programs and would need to make sure the cache content is ...
1
vote
1answer
19 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
10 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
49 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
26 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
51 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
24 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 ...
1
vote
1answer
51 views

linux command has different behaviour in script

(Question SOLVED and edited for helping someone else that need it or have the same mistake, now with the code in the post for better readability) I am trying to create a script that does something if ...
4
votes
1answer
60 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
3answers
185 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
31 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
42 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 ...
-1
votes
2answers
37 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: ...
-2
votes
0answers
27 views

how to set date from the main centos server to all remote server using bash scripts

h! Actually i want to set date from the main centos server to all remote servers simultaneously and no any date on remote server might be different with the help of bash script. In short getting ...
2
votes
1answer
80 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 ...
0
votes
0answers
4 views

How to prevent malicious injection in argument to php “exec” (webhook -> bash script) [migrated]

I've written a webhook to integrate into chat (slack / mattermost api). The simplest way to get it up and running was a quick php script, which looks like this: <?php $token = $_POST["token"]; ...
-2
votes
1answer
42 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): ...
1
vote
2answers
30 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
84 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
16 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 ...
0
votes
1answer
33 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 ...
2
votes
2answers
23 views

how to match a whitespace in a bash variable

According to the man page, the string to the right of =~ is treated as an extended regular expression. I've tried the following things to match an "ok" surrounded by whitespace on either side, but ...
1
vote
2answers
56 views

pacemaker corosynce lsb resource script( Sybase Database ASE Server and Backup Server)

I'm trying to create a lsb resource with pcs on rhel7.2 The "sybase" script is about Sybase Database ASE Server and Backup Server Startup & Stop & Restart $ status script Before ...
18
votes
2answers
3k views

Will Ansible prevent the execution of 'rm -rf /' in a shell script

This is based upon this hoax question here. The problem described is having a bash script which contains something to the effect of: rm -rf {pattern1}/{pattern2} ...which if both patterns include ...
2
votes
1answer
35 views

unix utility to limit the number of bytes placed into a bash variable

Is there a unix/linux utility, perhaps a shell builtin or an external command, that will limit the number of bytes placed into a bash variable? For example, I want to make sure STRING gets at most ...
5
votes
2answers
134 views

Cat, Grep, Redirect Output… Blank File?

I just ran cat /opt/webapplications/Word/readme.log | grep -v 'Apple' and I got the output on the cli that I was expecting, which was all the lines in readme.log that did not contain 'Apple'... ...
1
vote
1answer
44 views

Ansible & rbash

I want to manage a bunch of devices running /bin/rbash as the default shell with Ansible. The problem is that Ansible always tries to execute a list of commands that rbash doesn't like at all: umask ...
0
votes
0answers
23 views

Cacti poller runs but not full script

I'm using Cacti and the poller calls a bash script to get some data. At the end of this script I have a logical test and then an email is sent if true. The issue I have is when the poller is running ...
0
votes
0answers
21 views

“-bash: fork: retry: …” on SSH connection

When I'm connecting via ssh to my useraccount of my server, I'm getting the following error: -bash: fork: retry: No child processes -bash: fork: Resource temporarily unavailable Does anyone ...
0
votes
3answers
53 views

Bash if condition to check if a ubuntu package needs an upgrade?

I need a bash line to check if a ubuntu package needs an upgrade or not. For example, I want to check if the package 'firefox' needs an upgrade using dpkg or apt-get commands. Hypthetical Example: ...
0
votes
2answers
172 views

Unable to run a python3 script in CentOs7 [with python2.7] via cronjob

I have been trying to deal with this strage problem all morning. I have a simple crawler.py file, which contans a code that can only run under python3 to be exact under python3.3 evenrionment Now, ...
2
votes
2answers
53 views

printing user of subshell obtaining root via su -

Can I print the username which is obtaining root access via su - on the root console upon obtaining root? user1$ su - password: obtained root via user1 #
0
votes
0answers
8 views

su rails session mysteriously closes by itself

I need help troubleshooting a strange problem. When I ssh into a server I have and do an su rails from root user the session closes by itself: root@ubuntu-server:/4# su rails rails@ubuntu-server:/4$ ...
1
vote
1answer
53 views

ansible custom facts returning string not array

I have a custom fact for my servers to retrieve customer data. This works fine on the machine and returning valid json. I can write the output to another facts-file and this works perfectly fine too. ...
1
vote
0answers
36 views

Linux ramdisk transfer files on reboot [closed]

I've created a tmpfs ramdisk, which is mounted at boot through /etc/fstab. The ramdisk should be used to serve content to an apache web server running on the machine. Is there a simple way to ...
-1
votes
2answers
28 views

Job control: How to kill a sudo job using the job id

If I run jobs with sudo I can't kill %1 them (Operation not permitted). My first thought was to use sudo kill %1 instead, but that of course doesn't work either because it won't use the bash builtin ...
0
votes
1answer
55 views

Installing a software in multiple linux machines using shell scripting in one machine

I will login to one Linux instance using ssh - putty and my goal is to install a software (for ex: I need to download oracle and install it) on 5 Linux machines with one shell script when I run that ...
1
vote
0answers
23 views

Deleting files from Remote FTP-Server older than X days (only ftp, curl or lftp) [duplicate]

I have similar situation descibed here: Deleting files from Remote FTP-Server older than x days and I see this is not answered fully yet so I would like to register the new one. My files are having a ...
1
vote
1answer
43 views

nginx - How often was accessed to specific file or path? [closed]

I'm looking for a command/line to get the information how often was a specific file/path accessed from the web-server. (source: default access-log from nignx) It should check all logs (current and ...
1
vote
2answers
41 views

Script to combine data from one file to another [closed]

I have a file containing folders name/value pairs: peter:/home/peter/ max:/home/max-lucas/ judith:/home/judith/documents/ I have another file containing files name/value pairs, with the same ...
-1
votes
1answer
34 views

Cronjob doesn't run. Similar cronjob does run. Issue with Env Vars??? Fedora involved. psql involved [duplicate]

I have cronjobs like so * * * * * /usr/bin/psql -U usename dbname -c "select usename, now(), pg_terminate_backend(pid) from pg_stat_activity where state like 'idle%' and (now() - query_start) > ...