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 ...

learn more… | top users | synonyms

-2
votes
0answers
20 views

iptables shell command from php, does not apply fully?

I run a shell script from php. shell_exec("/abs_path_to/lorem.sh"); When I run the script in Terminal # sh "/abs_path_to/lorem.sh", it works. The script consists in iptables rules. I checked it is ...
0
votes
2answers
34 views

How can I redirect logfile output to a network socket?

I am using a commercial Java app which writes it's logfiles using log4j. I'd like to get those logfile entries into Syslog where we have specific filters setup to trigger on system events. Log4j ...
0
votes
0answers
24 views

bash scripting and comparing 2 directories - Beginner [duplicate]

My problem is that i have to check what files are included in the $directory, then i have to make a new file with name specified by me and compare if the name doesn't already exist in this directory ( ...
0
votes
0answers
10 views

shell script for checking the list of websites status [duplicate]

How can i write a shell script for Checking the list of websites in a server which are running up or not. If they are running leave it. Those who are not running what type of error it is popping out ...
0
votes
1answer
67 views

Shell script for docker ps -a | grep to find number of certain containers running

I want to write a script that is executed by my development build server that will remove any 'similar' docker containers before building and running a new container. Below is pseudo code for the ...
0
votes
0answers
17 views

Dangers of closing file descriptors

In the Stack Overflow question Check if a program exists from a bash script the accepted answer notes that closing stderr is dangerous: (minor side-note: some will suggest 2>&- is the same ...
1
vote
3answers
39 views

Execute Shell loop in parallel, but only N workers

We have more than 100 git repos, and sometimes I want to grep over all. To update the repos I use this: for repo in *; do (cd $repo; git checkout master; git pull); done This is quite slow. How ...
-1
votes
0answers
17 views

SSH gateway forward based on username [duplicate]

We want to use NAT to save public IP addresses. To gain ssh access to the virtual machine with an internal IP address we want to use an SSH gateway to forward sessions to the right server based on its ...
0
votes
1answer
28 views

Does whitespace matter in nginx conf files?

I have an nginx conf file that due to using environment variables, I have a shell script echo, this file I refer to as nginx.conf.template, then I place the echoed reult into the actual nginx.conf, ...
-6
votes
1answer
29 views

How to enable ssh access without public/private keys [closed]

I want to access my server via terminal like this: ssh username@host.com Password: (enters password) ... I have access to cpanel for this server. There is a section called "SSH access" where I can ...
0
votes
1answer
29 views

Change shell prompt based on container name?

I have been doing a lot of work using Linux containers, and I keep forgetting which of the terminals on my screen is running inside which container, particularly when I leave them open overnight. How ...
0
votes
0answers
33 views

I need to convert system log file into xml or readable form

I need to convert system log file (start -> administrative tool -> event viwer) into readable form like .xml. how can i did this via command prompt.. I did this using PowerShell by this command ...
0
votes
0answers
47 views

Change ram usage in apache.conf

I´m triggering a shell command from my PHP script. As it is much slower when running from my Webserver then manually from shell, I thought the max ram per Apache Thread might be the reason. The ...
1
vote
1answer
38 views

unexpected end of file error in script file

#!/bin/sh # Host = ############### Port = #### email_id="##################" email_sub="######" # if ping -q -c 5 $Host >/dev/null then result_host="Successful" else result_host="Not ...
1
vote
2answers
38 views

Why is the cron ENV different from the user's ENV?

On a new Ubuntu install, a user's PATH is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games But in that same user's cron environment, it is: /usr/bin:/bin ...
1
vote
0answers
46 views

Echo each shell script command with a timestamp

set -x or set -v prints every executed command. How do I get the command printed with the time when the command started executing?
0
votes
1answer
99 views

run PHP file from shell script

I have never added a cron job and am not much use with shell either... My chosen cron directory is /etc/cron.daily/ all I need my script to do is run a php file daily. I would be nice if it ran at ...
0
votes
3answers
62 views

Doing a backup with mysqldump and drop it on another server (Bash)

I'm using a cron job to do backups hourly and now, I want to drop those backups on another server by default. My script is the following: mysqldump -u db_user -p db_password db_name| gzip > ...
4
votes
1answer
136 views

Running detached screen session but without termination in the same bash

Here are already many questions like this, but every one recommends (a variant of) the following solution: screen -dmS somename bash -c "/path/to/script; bash -l" e.g. when the script ends, run an ...
0
votes
2answers
74 views

What is making /tmp/info-html*.tmp files and how do I stop it?

What is making /tmp/info-html*.tmp files and how do I stop it or configure it to clean these up and/or make these somewhere else? For example, # ll /tmp/info-html* -rw-r--r-- 1 user user 0 Oct 30 ...
0
votes
1answer
67 views

sftp: get file by mtime

Objective: Connect to sftp server with very simple script using -b option, cd to directory and get file with the latest modified time or created time. I can connect and download *.csv but that may ...
1
vote
2answers
94 views

Why can't I capture AWS EC2 CLI Output in Bash?

I am trying to capture the output of an aws ec2 delete-snapshot in a Bash script command but I cannot get anything to capture the output. I have tried result=$(command), result=`command` etc. but when ...
1
vote
2answers
116 views

How to generate gpg key without user interaction?

I found in https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html#Unattended-GPG-key-generation method to generate gpg keys without user interaction, but it doesn't seem ...
1
vote
1answer
61 views

Trouble installing ZSH

I did the following: yum install zsh Then chsh eduar New shell [/bin/bash]: /bin/zsh When I type: curl -L http://install.ohmyz.sh | sh I got this: You already have Oh My Zsh ...
0
votes
2answers
211 views

Shell Script to connect to Database and execute query [closed]

#!bin/bash Query="update table_name set colume ='i' where column_name is NOT NUll" mysql -u username -p password mysql <<EOF $query; EOF The above script is not working
1
vote
1answer
499 views

Add cronjob with bash script - No crontab for root [duplicate]

I have a deployment script and in it I'm trying to add a cron job. This is the code I am using which I found on stackoverflow. I'm running debian 8. # ADD CRON crontab -l > mycron echo "10 * * * * ...
1
vote
0answers
53 views

mail send format issue in different linux servers

I have created a send mail script which will run on couple of my client servers. The mail was sent correctly in couple of servers but in some servers the format we receive is not what what we ...
1
vote
1answer
430 views

Update version of network manager

In shell on sever I see following error after launching several commands: Error: nmcli (1.0.0) and NetworkManager (0.9.9.1) versions don't match. Force execution using --nocheck, but the results are ...
0
votes
2answers
65 views

Add a user from root with ssh key

Perhaps a strange question, but I'm not a shell script expert. I'm provisioning an Ubuntu server starting out as root. I'd like to non-interactively setup a new user account, remove root login and ...
0
votes
1answer
107 views

Nagios bash syntax error

I want to refer with this question to the following post where I got the Skript: Post with Script I'm using Bash 4.1.2(1) and when I try to execute the script, I get following error messages: ...
0
votes
1answer
43 views

Crontab is delayed by 2 hours [duplicate]

I have got a problem with two crontabs that execute some operations on my website: the first one run a command every 3 minutes and the second one at 5am in this way: m h dom mon dow command 0 ...
0
votes
2answers
357 views

Installing PHP extensions to the correct PHP version

We have two versions of PHP on our Linux CentOS6 machine, 5.3.3 and 5.6.7, and wanted to install PHP extensions, memcache and imagick, to 5.6.7. Logged in as root, using yum, we installed both of ...
0
votes
1answer
60 views

Suhosin - Disable shell_exec default, allow from one directory

I have in php ini this function, which blocks shell_exec default. php.ini suhosin.executor.func.blacklist = shell_exec Its works well. When I want to allow shell_exec, so I use in httpd.conf ...
0
votes
1answer
307 views

How to scp file to remote servers' root directory and run sudo commands?

NOTE: The servers does not share the same password but I will setup no-password login at first. Here's the use case, I need to do these below step by step in my deploy.sh: scp files to remote ...
0
votes
1answer
30 views

Check if user is logged in VSFTPD (from the server)

I need to solve a task with a script. I moving files from a user home directory to another storage regularly (in every 5 minutes and so). How can I detect if this user is logged in (via VSFTPd ...
0
votes
2answers
70 views

Can I get an array as an option argument in bash script

I am writing a shell script and wants to pass multiple options in an argument. Is it possible to do that like using getopts? Requirement example: ./shell.sh -d db1 db2 should pass the values db1 ...
2
votes
2answers
308 views

bash: convert date from to unix timestamp changes timestamp

Running the following command at the xen-servers (either DOM0 or DOMU) at $company gives me a negativ number, on every other system zero (0) (even in my cygwin). date -d "1970-01-01T00:00:00" "+%s" ...
0
votes
0answers
34 views

Configure to enable login in a different shell pass through default shell in SSH

I would like to configure a SSH server in Linux that be enable to login a user in two different shells: one by default and one alternative. I have tried configuring SSH subsystem. I can configure ...
0
votes
0answers
25 views

ForceCommand vs Subsystem

Is there any particula reason why I should use ForceCommand internal-sftp instead of Subsystem sftp iternal-sftp and disabling the shell?
-1
votes
1answer
54 views

understanding the result of this bash script [closed]

I have this simple bash script #!/bin/bash -x for line in `tail /home/user/line` do echo $line done but dont know why it echos all words instead of each line below is output ++ tail ...
-1
votes
4answers
458 views

How to test if two given files are identical?

Just updated the code... I get out everytime on the "else" sequence. You can download the update.sh file from my server. it only contains echo "Hallo update" Updated code (03.11.2015) ...
-5
votes
1answer
62 views

How to password protect a file? [closed]

I have a script called 'Linux.sh'. This script should be executed by every one . it should prompt for password when some one edit it . I have tried by using ' vi -x linux.sh ' to password protect the ...
3
votes
4answers
36 views

Bash evaluation baffling

I'm trying to get a script to do something when one number is bigger than another, in this case, when the system load average exceeds a defined value. All of it is working aside from the evaluation ...
0
votes
1answer
15 views

Nova CLI yields zero output on stderr and stdout

following problem. I got this shell script: #!/bin/sh # Provide log for debugging if [ ! -f /home/some-user/port-control.log ]; then touch /home/some-user/port-control.log chown some-user ...
1
vote
0answers
67 views

Linux: What could be the reason for random fails in updating passwd.byuid by running yppasswd?

In order to allow NOC users in my company to manage users through NIS I've created the following script: #!/bin/bash # This script will simplicate NIS user management. # You will not be able to ...
0
votes
0answers
38 views

Init script only offers help suggestion

I modified the uwsgi init.d script for debian from the apt-get package download. This is the script I have below: #!/bin/sh ### BEGIN INIT INFO # Provides: uwsgi # Required-Start: ...
0
votes
0answers
22 views

How to escape pipeline char in Windows shell?

I need to specify a regular expression that includes | character to findstr command: processtext.exe | findstr /R "Hello|Bye" How do I escape it? \| does not work. Quotes fix issue with pipelining ...
3
votes
3answers
611 views

Why cd does not change current directory in crontab?

In my user's crontab, on a CentOS system, I have something like this: 58 12 * * * cd /home/joe/dev; echo `pwd` | logger This outputs in /var/log/messages: Feb 19 12:58:01 srv01 joe: /home/joe ...
1
vote
0answers
113 views

How to package shell script file with license key file

I am working on automated shell script for specific task . Before executing task steps I want to validate the license key provided to the customer with a webservice call. Please help me in making ...
0
votes
0answers
27 views

Is it possible to break out of a “trap 1 2 3” secured terminal session by using SIGSEGV?

The title says it mostly. I'm auditing the security of a terminal-based application on AIX, and the way you use it is to connect to it remotely through telnet, where the ".profile" of the telnet user ...