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

1
vote
0answers
12 views

Shutting down host from within jail

I've created a jail with ssh using Finch-Freebsd on a NAS4FREE and added a local non super user to access the jail via ssh. I want to be able to grant this user limited shell access specifically to ...
3
votes
1answer
2k views

Linux- Permission denied?

I'm installing Neo4j server as a linux service, but when I install it, I get the following message: /sbin/insserv: Permission denied What is this? What should I do? I'm running everything with ...
1
vote
1answer
45 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 result into the actual nginx.conf, ...
2
votes
3answers
3k views

gpg-agent says agent exists, but gpg says agent doesn't exist?

I'm struggling with some issues while scripting gpg with bash on a Debian 6.0.6 box. I have a script that does a batch of operations and wants to make sure that a gpg-agent is available before it ...
150
votes
4answers
54k views

What is the difference between double and single square brackets in bash?

I just wondered what exactly the difference between [[ $STRING != foo ]] and [ $STRING != foo ] is, apart from that the latter is posix-compliant, found in sh and the former is an extension ...
5
votes
3answers
3k views

Can't run AWS CLI from CRON (credentials)

Trying to run a simple AWS CLI backup script. It loops through lines in an include file, backs those paths up to S3, and dumps output to a log file. When I run this command directly, it runs without ...
13
votes
5answers
16k views

How to let 'cp' command don't fire an error when source file does not exist?

I'm using Mac OS X. I'm trying to copying some files with cp command for a build script like this. cp ./src/*/*.h ./aaa But this command fires an error if there is no .h file in ./src directory. ...
-2
votes
1answer
28 views

Crontab process not working [closed]

I have a crontab process to start run a .sh script which starts a .jar file. Although when I added multiples (changing the correct paramaters) It stopped working. This is my cron file * * * * * ...
0
votes
1answer
20 views

Cannot change default shell in solaris 8

I have a situation. We have Solaris 8 machines. For every users we have to change the shell from /bin/sh to .../sdshell. So far we have been doing it by editing the /etc/passwd file manually. Is ...
1
vote
2answers
34 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 ...
8
votes
8answers
13k views

Unix shell: easy way to get IP from hostname

What is the easiest way to get the IP from a hostname? I was thinking about trying a ping and parse it from the output. However, that doesn't seem very nice and will probably not work the same way on ...
1
vote
1answer
16 views

Python script crashes when run via Cron

I have a python script that completes exactly as expected when run manually as the root user. When I put the script into cron.daily it crashes 100% of the time. The error is a timeout error, but ...
0
votes
0answers
4 views

Unable to specify a paper try with bash script [migrated]

So we use a bash script that sends control codes before printing to set some things on the printer. At the end of the script it calls a standard LP command. I add the option to print to a specific ...
0
votes
1answer
27 views

sudo (-E) doesn't preserve path, even when configured appropriately

I have circus installed in a python virtualenv using virtualenvwrapper, and I want to run it with sudo. Sounds simple, right? Unfortunately even after reading man sudo and man sudoers, I don't ...
8
votes
8answers
7k views

How to determine if I'm logged in via SSH?

I'm currently setting up a fairly complex bash configuration which shall be used on multiple machines. I try to find out if it is possible to determine whether I'm logged in via SSH or on a local ...
0
votes
0answers
6 views

Odd syntax for ssh and bash to run command [migrated]

I'm pretty new to shell/bash scripting and I'm writing a script on OSX to automate some rather tedious efforts. I'm trying to run a portion of my script on a remote host using ssh. There's a common ...
0
votes
1answer
938 views

expect script not working with bash script

I want a script that ssh to remote server and then run a script which is at my local machine and then store the output on my local machine Expect script for ssh to remote server: #!/usr/bin/expect ...
1
vote
2answers
21 views

How to prevent rsync from chown'ing remote users files

I'm doing rsync /local/path/to/src user1@remote:/path/to/dest. dest belongs to user2@remote. How do I keep rsync from chown'ing dest to user1 after syncing? Please note that I have already tried ...
1
vote
4answers
157 views

shell script $$ value

When I use these shell commands: [root@linux /tmp]# a=$$ [root@linux /tmp]# echo $a 3985 where does the value 3985 come from? And why?
3
votes
6answers
11k views

run script as another user from a root script with no tty stdin

Using CentOs, I want to run a script as user 'training' as a system service. I use daemontools to monitor the process, which needs a launcher script that is run as root and has no tty standard in. ...
0
votes
2answers
21 views

Move all ls output and symlink

I want to move some of my files in directory to another drive and create symlink for each of them in the old directory that will point to the new directory. For example, [root@localhost olddir]# ls ...
3
votes
2answers
5k views

Override LDAP shell

I have a LDAP server and a predefined shell (bash) set in it. But there are some machine on which I want a different shell to be used whenever user login to that instead of the shell stored in LDAP. ...
2
votes
4answers
2k views

Upstart script vs. command-line: why this difference in behavior?

I'm trying to set up Tomcat to start with upstart. I find the following works: description "Tomcat Server" start on runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 ...
12
votes
5answers
2k views

How to remove many (200 000) files?

I must remove 200 000 files (all of them) from a folder, and I don't want to delete the folder itself. using rm, I get an "Argument list too long" error. I've tried to do something with xargs, but ...
0
votes
2answers
42 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 ( ...
27
votes
24answers
44k views

Finding the Public IP address in a shell script

I can find my IP address using ifconfig or hostname -i command. But how do I find my Public IP? (I have a static public IP but I want to find it out using unix command)
3
votes
1answer
3k views

How to automatically reconcile /etc/group and /etc/gshadow

Running grpck to check the groups, I see these errors: 'twinky' is a member of the 'foo' group in /etc/group but not in /etc/gshadow 'dipsy' is a member of the 'foo' group in /etc/group but not in ...
2
votes
6answers
3k views

Running ssh-agent from a shell script

I'm trying to create a shell script that, among other things, starts up ssh-agent and adds a private key to the agent. Example: #!/bin/bash # ... ssh-agent $SHELL ssh-add /path/to/key # ... The ...
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 ...
1
vote
3answers
43 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 ...
0
votes
1answer
118 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 ...
41
votes
6answers
72k views

How can I kill all stopped jobs?

When I try to exit from my Linux server I get the message: There are stopped jobs. : Is there a single command to kill these?
0
votes
2answers
464 views

dsh (dancer's shell): is it possible to specify ports in config file?

Using dsh you can define the list of machines in ~/.dsh/machines.list in the form: <user>@<host> I'd like to have multiple hosts with different ssh ports, like this (I tried): ...
-6
votes
1answer
30 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 ...
6
votes
2answers
2k views

nc (netcat) hangs, waiting for more data, in UDP mode.

I'm trying to send a small string to statsd via nc inside of a read block: while read line; do printf "folder.counter:value|1c" | nc -q 0 -u $host $port done Unfortunately, when in UDP mode, nc ...
0
votes
1answer
31 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
49 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
55 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 ...
0
votes
1answer
71 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 ...
6
votes
5answers
704 views

Hide the output of a shell command only on success?

Hiding the output of a shell command usually involves redirecting stderr and stdout. Is there any builtin facility or command which by default hides the output but on error dumps all the accumulated ...
6
votes
5answers
6k views

Templating with Linux in a Shell Script?

what I want to acomplish is: 1.) Having a config file as template, with variables like $version $path (for example apache config) 2.) Having a shell script that "fills in" the variables of the ...
1
vote
2answers
40 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 ...
6
votes
3answers
1k views

If condition is true, sleep the cron job for 5 minutes

I have a script set to run after every minute. But in the script we have mentioned, if a condition is true, the script has to sleep for 5 minutes. How could this affect the crontab? Will the script be ...
5
votes
1answer
6k views

Run command in detached tmux session

This is probably simple, but I really can't find out how you do it. I have read the man pages and googled without results. Problem: How do I run a command in a detached tmux window? Example: I want ...
3
votes
2answers
3k views

Hang while starting several daemons

I’m running a Debian Squeeze AMD64 server. Target runlevel after boot is runlevel 2, which includes rsyslogd, cron, sshd and some other stuff, but not dovecot, postfix, apache2, etc. The system fails ...
7
votes
4answers
6k views

chsh: PAM authentication failed

i want to change default shell env and run chsh -s /bin/zsh as root user, but a error message appeared: chsh: PAM authentication failed. i find this thread ...
2
votes
1answer
2k views

How can I start a shell inside a jail on FreeBSD?

I have access to a a previously set up FreeBSD box with a number of jails on it. One of the jails is an SQL server, and does not have ssh enabled on it. How can I gain access to a shell on that jail ...
1
vote
0answers
49 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
197 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 ...