Questions tagged [shell]

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion. Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

Filter by
Sorted by
Tagged with
0
votes
1answer
37 views

SSH hangs on “exec request accepted on channel 0”

I have a question that appears very similar to others that have been asked but none of them have answered my problem. I'm running into an ssh error on sending a command (not loading an interactive ...
1
vote
0answers
46 views

What is shell's maximum background jobs PID stored exit-codes?

When running a shell job in the background, the shell keeps track of the exit-code that can be retrieved with wait <PID>. When a new background job is run, it gets its own new PID, even if ...
3
votes
2answers
42 views

Looking for the Docker way to get just the 1st Repository Tag in “docker inspect”

I'm trying to find the proper way to get just the 1st Repository Tag of a Docker Image in a Linux shell. This can be achieved the ugly way by: docker inspect e77e5ce5d4e3 --format='{{.RepoTags}}' | ...
0
votes
0answers
33 views

Stopping a service stuck via ssh heredoc in a bash script after Centos 7.7 upgrade

I had this logic in Jenkins jobs to deploy code on remote host which was stopping a service and starting again. It was all working fine till recent Centos upgrade to 7.7 (CentOS Linux release 7.7.1908 ...
0
votes
1answer
27 views

How to extract the text inside a block in an HCL (HashiCorp Configuration Language) file using Bash? [closed]

I have a HashiCorp Configuration Language (HCL) file with this block. database = { gdb_name = "XXXXX" sid_name = "XXXXX" createContainerDB = "True" ...
0
votes
1answer
25 views

Log shell stdin & stdout

I'm trying to setup a bastion that I would like to log all commands executed and output to (ideally per-user) log files. I looked at auditd, and can see how to log commands executed to system I don't ...
1
vote
3answers
57 views

Server A tells server B to execute shell script - simplest way?

The question I have is vague, but it's vague on purpose because I don't want to bias the answers toward a needlessly specific solution. Let's say I have Linux servers A and B, where server A has a ...
0
votes
2answers
47 views

Limiting shell access for git users, but still allowing push / pull access

I'm host a git repository on my server. Anyone can push / pull from the following remote url: ssh://git@example.com/opt/git/my-project.git Specifically, anyone with ssh access to the git@example.com ...
5
votes
1answer
247 views

Is it possible to listen to a TCP port only with a shell, with no additional tools? [closed]

I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port. The problem is that the ...
0
votes
1answer
65 views

Cannot find my database when trying to import with mysql

When I connect to the mysql shell and do a SHOW DATABASES, i get this | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | rd7 ...
0
votes
1answer
33 views

Glob match recursive delete directories except a certain directory

How can I delete all directories recursively where the name starts with app-deployment-* except a particular directory with name app-deployment-245a578. I.E. delete all directories using a glob match ...
2
votes
3answers
67 views

CentOS 7 how to get interface name by macaddress?

I'm trying to figure out how I can get the network interface name and then change the name. Right now it's easy to change the name with this example: ip link set eth1 name <newName>; However I ...
0
votes
2answers
107 views

Parse Date from Text String in a 3 column format

I am given an array of lines from a text file. They look similar to this, and will always be structured like this: Full Tue Aug 27 10:59:43 2019 1 ...
0
votes
1answer
35 views

Error running commands using shell although successfully run line by line manually

I'm using centos7 RHEL on vagrant virtualbox, I'm making a shell file that when I activate vagrant it runs the commands in the shell file on the virtual OS. When I use SSH and run each line on ...
1
vote
3answers
64 views

How to run a shell script on a server farm periodically

I have a requirement to collect custom metrics (a shell script) from a logical server cluster every five minutes. This server cluster consists of 10 virtual machines. Once option i am familiar with is ...
1
vote
1answer
115 views

Shell script prevent switching to other shell or escape from it

If in my automation script, I need to do something like install oh-my-zsh, I will have a .sh script like this: #!/bin/sh runuser -l user -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/...
-2
votes
1answer
57 views

How to use asterisk in a shell program

I want to use Asterisk in a shell Linux program more or less like this : asterisk -r && console dial 101 How can I do that ? Thank you.
0
votes
1answer
30 views

Centos - terminal creates directories/files with no owner/group?

I'm very new to server admin. I'm having an issue whereby any file or folder I create via the terminal on WHM (Centos 7.6) results in a file/folder with 0/0 user and group stat. Example command: ...
0
votes
0answers
43 views

cron job not working in unix but works when executed manually [duplicate]

I am running a cron job everyday at 21:00 UTC which downloads few csv files from sftp server, renames the downloaded files and then loads the files in database(mysql) and updates the time in database (...
1
vote
2answers
120 views

Cannot Use CURL on /etc/pam.d/sshd

I am creating a script that doing cURL everytime SSH login happens. I inserted a new line in /etc/pam.d/sshd like this: auth required pam_exec.so /bin/curl.sh and my curl script is like ...
0
votes
0answers
9 views

Which variant of start of Tomcat from special user in Linux are better?

I have bash script with two variants 1) /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh 2) su $TOMCAT_USER -c $TOMCAT_HOME/bin/startup.sh Which variant are better ? Both variant ...
0
votes
1answer
54 views

Bash command to execute a foreground set of background commands

I got 2 commands that run blocking the input in the console, so they must be ended with CTRL+C. I don't like running them in background, since I lost control for interruption. But otherwise I cannot ...
0
votes
1answer
64 views

Use shell if defined in LDAP, otherwise default

How should /etc/sssd/sssd.conf file be configured to use the shell defined in LDAP and the default one if the variable is not defined in LDAP?
0
votes
0answers
128 views

Why does my root login only have basic commands available when ssh'd to ESXi host?

We are having an issue with our 6.5 ESXi host. As part of our troubleshooting we have enabled ESXi Shell and SSH. Between VMWare Docs and community posts I keep seeing that we are supposed to be able ...
0
votes
1answer
26 views

Uploading files using tar

Can you help me? I have this piece of code that I'm using on my Ubuntu 16.04 server tar -c /var/www/dxa/backup.zip | ssh <my-server-ip> -p 8000 'tar -xvf - -C /' But everytime I run this ...
0
votes
1answer
194 views

How to install sqlcmd on windows core

I have inherited a sick WSUS server running on MS Windows core (i.e. no desktop). The CPU is maxed out by the sqlserv.exe process. This appears to be the embedded version rather than a full featured ...
0
votes
0answers
105 views

Allow php to run shell script with sudo permission

command php -v is working when I execute simple shell_exec('./script.sh'); but when I use sudo it doesn't work without sudo service stop command is not working. var_dump(shell_exec('sudo bash ./...
2
votes
2answers
40 views

sed insert a string into a matched line inside quoutes

I'm writing a shell script that modifies GRUB options: sed "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/$/ mem_sleep_default=deep /" /etc/default/grub This sed command matches the line ...
0
votes
0answers
29 views

Cannot set alias for git with --git-dir on ZSH

Im trying to follow follow this tutorial here https://www.atlassian.com/git/tutorials/dotfiles which involves aliasing git together with a git-dir. But when I try to use --git-dir my shell tells me "...
0
votes
1answer
1k views

Pass variable in remote SSH-command in Jenkins-job

i have a little test job: touch 22.txt echo "wwe" > 22.txt test=$(echo ${BUILD_NUMBER}) echo $test ssh jenkins@srv1 "mkdir D:\myfolder\$test" ssh jenkins@srv1 "dir D:\myfolder\" BUILD_NUMBER ...
-2
votes
1answer
35 views

converting bat to shell script

I have source of batch files which i need to convert to into shell script,i have do converted most of the code but got stuck with the following code because i could'nt find any shell equivalents for ...
1
vote
2answers
32 views

How to check: variable of function is it path to a folder or file on a remote server?

I need to use rsync or scp for copy file or file folder from remote server to computer. To copy (synchronize) a file folder I use the following function: foldertocomp() { rsync -avz pi@192.168.1....
0
votes
1answer
396 views

Unable to run docker-compose from ssh's shell

I'm working on setting up a script in my .gitlab-ci.yml file so that I'm able to deploy a newly built Docker image to my server. Here is how it looks so far: - ssh deploy@my.private.vps '/bin/sh -c "...
1
vote
1answer
169 views

Ubuntu 18 ignoring Samba AD user's `loginShell` attribute (set to ZSH, but user receives BASH after login)

We have a samba AD (4.3.11-Ubuntu) attaching to both Windows and Linux clients (Ubuntu 14, and Ubuntu 18) If I examine the LDAP for a user, his loginShell parameter is /bin/zsh. This was working for ...
0
votes
0answers
661 views

How to manually setup network connection from Busybox shell (ash)?

An embedded device running Linux version 2.6.26.5, ARM Linux Kernel. Busybox v1.10.2 shell (ash), I'm in Busybox shell. I want to set up connection between embedded device and computer. Is it ...
-2
votes
1answer
35 views

How to output one number few times with spaces in one line via bash [closed]

How to output one number few times with spaces in one line via bash I have a=5 b=10 I should output 5 times number 10 with using of variables and with spaces Also, i should capture this in variable ...
-2
votes
1answer
66 views

Freebsd 11 custom installer memstick with packages [closed]

I use freebsd 11 memstick installer image always but need some packages if I install freebsd 11 then I should install some packages ( phpmyadmin, php7, nginx, mysql, nano) and enabled root ssh vb ...
0
votes
1answer
37 views

get a specific line from in linux using grep

Hello I am new to linux and grep and awk commands. I am trying to get the number value from this string variable and then store it in another variable. var1="Version must be incremented on update. ...
0
votes
0answers
89 views

Compare processed output of command to string in bash

I am not able to get the correct output comparing the output of a specific to a simple string I have tried many different ways but not working so far #!/bin/bash redis_info=$(redis-cli info ...
0
votes
0answers
18 views

Container for testing scripts with the same versions of tools as OSX

Is there any sort of maintained container image that someone has created that contains the same (or very similar) versions of the shell and associated commands as those that are provided by OS X? ...
9
votes
3answers
3k views

Database accidentally deleted with a bash script [duplicate]

Edit: a follow-up question: Restore mongoDB by --repair and WiredTiger. My developer committed a huge mistake and we cannot find our Mongo database anywhere in the server. He logged into the server, ...
2
votes
1answer
88 views

How to de-duplicate 130 million files and sort them by size on a relative limited server?

There are about 130 million (129923145, precisely, by find . -name "*.*" | wc -l) pictures on server. They need to be de-duplicated, and packaged to zip compressed file from smallest to biggest for ...
0
votes
0answers
114 views

ImportError: No module named dirsync

I have installed dirsync 2.2.3 from dirsync and trying to run a very basic program from my raspberry pi using python My script is from dirsync import sync sourcedir = '/share/Festplatte/Saqib/pitopc/...
0
votes
1answer
24 views

Loading new paths from each line on a text file with eval dont update $PATH variable on bash

Having to set a lot of paths on $PATH then wrote this code to load it from a text file: #!/bin/bash cd ~ echo '#++++++' >> ./pathlstbkp cat ./pathlst >> ./pathlstbkp while ...
1
vote
2answers
4k views

Ansible task write to local log file

Using Ansible I would like to be able to write the sysout of a task running a command to a local(i.e. on the managed server) log file. For the moment I can only do this using a task like this: - name:...
0
votes
1answer
25 views

Self extract ZIP that can run a command

I have: install.sh config/* images/* etc I would like to bundle all that up in 1 file, so that when the user runs that file (no args), it will: self extract in /tmp/[temp_name]/ run /tmp/[...
0
votes
1answer
135 views

Bash command stdout

I'm trying to get a software version by using the bash script. The Command is simple: /usr/local/sbin/keepalived -v This is the output: Keepalived v2.0.13 (02/18,2019), git commit v2.0.12-53-...
-1
votes
2answers
41 views

Trying to execute this shell script but getting this error

Trying to execute this shell script. #!/bin/bash # Proper header for a Bash script. # Cleanup, version 2 # Run as root, of course. # Insert code here to print error message and exit if not root. ...
1
vote
1answer
504 views

scp with special username

I'm trying to create a shell script for copying files to a remote backup. This is my script so far: PASSWORD=MY-SECRET-PASS URL=SLOS755513-3:SL1255513@objectstorage.net DIR=/backup scp /home/user/...
0
votes
2answers
717 views

Escape all characters that shell or sqlplus need escaped in any password given

You may try for yourself by creating this user: CREATE USER "karl" IDENTIFIED BY "/?'!@#$%^&*()_+=-~`" (Maybe there are other symbols I should have included for my testing, but that seemed ...