Tagged Questions

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
3answers
1k 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 ...
-2
votes
1answer
258 views

sh dev/null Permission denied apache

I am using Mac osx Mountain Lion for development. I am trying to execute a shell command in php using the 'exec' function. At the end of my command I am putting the output to > /dev/null 2>dev/null ...
-1
votes
1answer
43 views

Different behavior from ubuntu server and ubuntu client on windows [closed]

#!/bin/bash # Reading cat /home/radiare/Desktop/first.txt | while read LINE do if [ "$LINE" == "false" ]; then echo "Inside first loop" break fi done cat /home/radiare/Desktop/second.txt | while ...
0
votes
2answers
145 views

Debian shell script to update server software

A lot of my server software is installed via apt-get and I was wondering if there is a small shell script I can get which will will update all of this software. Also do I need to restart my server ...
2
votes
2answers
207 views

Appending data to file with a single open/close from a shell script

I need to adjust my shell script and write to $log multiple times. Opening and closing the file repeatedly will cause an increase in runtime. How can I write everything at once to the file, ...
1
vote
1answer
448 views

Group permission inheritance and umask

Edit: in my case virtual_use_local_privs=TRUE did the trick. i'm trying to force newly created files and directories inside foo/ directory to be owned by nginx user and to set the right permissions ...
-1
votes
2answers
327 views

“su” does not work on FreeBSD

Below I sun "su" command on FreeBSD: FreeBSD rand.vstyle.local 9.0-RELEASE FreeBSD 9.0-RELEASE #0 amd64 This is server RAND :) [svn@rand ~]$ su logostudiotest1 /bin/ls Password: /bin/ls: /bin/ls: ...
0
votes
6answers
3k views

Bash script runs manually, but fails on crontab

I'm a newbie to shell scripting. I have written a shell script to do incremental backup of MySQL database.The script is in executable format and runs successfully when executed manually but fails when ...
0
votes
2answers
167 views

Get memory usage in CentOS formatted

What is the best way in CentOS via a shell command to get the memory usage/free memory formatted like: Memory used: 389MB of 1024MB I know about free -m but parsing it, provides a challenge.
1
vote
4answers
75 views

Howto: command/tool ability check

When developing a shell script that should run on various unix/linux derivates, i sometimes have the problem that some tools have to be called in a different way compared to other systems. For example ...
0
votes
1answer
83 views

ZSH escaping / file matching pattern

This works from command line: scp -r ^.git b:/home/wopi/blyzics/. when I paste the above line in a script like this: #!/usr/bin/env zsh scp -r ^.git b:/home/wopi/blyzics/. And run it ...
1
vote
1answer
351 views

Counting the number of flows in a tcpdump file

I have a large tcpdump file which I need to parse to identify the number of flows in the capture based on the ( source ip + source port , destination ip + destination port ) pairs. Does tcpdump / any ...
0
votes
1answer
326 views

replace dates in XML file on a Linux server

I'd like to change the date format in the contents of an XML file from 2013-01-21 to January 21 The following script works on my mac, but not on a linux server (I'll be running it as a daily cron ...
0
votes
1answer
245 views

Error when sending an email from the shell using sendEmail

I'm using sendEmail to send emails using google account .. it is working fine on number of identical servers but on one if the servers it gives me the following error smtp.gmail.com:587 failed: ...
2
votes
1answer
440 views

Can't set TERM permanently in fish shell

I use the fish shell. I'm trying to run vim inside tmux with the solarized theme, but the colors are broken unless I run: set -lx TERM screen-256color-bce; before running tmux attach. It's ...
0
votes
0answers
104 views

Export system wide env variables at boot

how can I export a list of env variables at server startup so they can be reached system wide and without having to login with a system user ? I've used /etc/profile to export this list of variables ...
-3
votes
2answers
296 views

Simplest way to jail users for git [closed]

I'd like to create a couple user accounts on my server such that the users can check out a specific git repository. Ideally, the user would not be able to gain access to a shell or copy any files ...
0
votes
2answers
511 views

Cannot change chmod from bash script

I made a script to copy an image to a temporary directory, convert it to an another format, then move it to a final directory. But i can't get the chmod command to work, the file is copied to the ...
1
vote
2answers
175 views

Making a user account dedicated to a single script in centos

I am trying to make a SSH login for someone on my box. But when they login I want it to auto load a perl script and for them ONLY to be aloud to see / use that perl script. I only know how to use ...
1
vote
1answer
110 views

What shell script is calling rsync? [closed]

For the last couple of days, I've woken up to find rsync churning away with 1.6GB of memory, slowing my Mac down significantly. Activity Monitor only says that rsync is coming from sh, but I'm trying ...
0
votes
4answers
375 views

Daemon process exiting when shell closes

I have a script which starts a daemon process and then sleeps for 20 seconds. If I run the script on SLES11 SP1 or RHEL6 then after the script exits the process is still running. If I run the script ...
2
votes
3answers
1k views

Reboot if tomcat7 service is not responding

I am running a web app on a Tomcat server. There is a hard-to-detect problem within the server code that causes it to crash once or twice everyday. I will dig in to correct it when I have time. But ...
2
votes
1answer
137 views

How can I calculate the total size of an extremely large number of files with a particular extension?

I've got a directory in Linux that contains a large number of files (tens of thousands), plus directories that may contain thousands of files as well. At some point the following du command fails ...
2
votes
1answer
1k views

Force “net user” command to set password longer than 14 characters

I'm issuing some "net user" commands to setup a local user on my desktop for some testing purposes and require setting a password longer than 14 characters. In doing so Windows barks back a propmt to ...
0
votes
2answers
454 views

How to add a variable into a grep command

I'm running the following grep command var=`grep -n "keyword" /var/www/test/testfile.txt` This work just as expected but I need to insert the file name dynamically from a loop like so: var=`grep ...
1
vote
4answers
576 views

run php script in the background

is there a way to launch a php script and let it run on the server until it finishes? I use this php5-cgi /var/www/script.php -q & connecting via putty. When I close it (the session) the ...
0
votes
1answer
427 views

Error while trying to unrar

unrar: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory Both rar & unrar are in the /bin folder I followed this tutorial: ...
0
votes
2answers
183 views

Tool to execute shell script

I have a requirement to execute multiple shell scripts on the Linux severs regularly. Is there any tool in windows that connect to a Linux server and execute the given script with given user and shows ...
2
votes
2answers
1k views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I ctrl+C the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
0
votes
1answer
791 views

List files with last access date in linux

I'd like to clean up a server that my webmaster let turn into a mess. I know how to list all files not accessed within the last x days using find and -atime, but what I'm looking for is to come up ...
2
votes
4answers
527 views

Recursively delete directory except for some files in Windows

In Windows, I need to recursively delete a directory except for a short list of files to be kept. The files may be nested in subdirectories. I tried making the files read-only before running "rmdir ...
2
votes
4answers
645 views

SSH connection closes as shell fails to load

I have FreeBSd running with OpenSSH. I set up everything and the connection via SSH worked perfectly. Then I decided to get rid of some not used ports and I obviously uninstalled one that was used by ...
0
votes
1answer
922 views

reading stdin in shell

#!/bin/sh #myVar=`date`#case 1 #myVar=`cat /dev/stdin`#case 2 myVar=($(< /dev/stdin)) #case 3 echo $myVar exit 2 case 1 works case 2 and 3 don't work. When I test with either 2 or 3; there is no ...
1
vote
1answer
948 views

changing network speed to 1000Mb/s

I am trying to change the server uplink from 100Mb/s to 1000Mb/s ethtool eth0 output # ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: ...
0
votes
1answer
97 views

Parenthesis in cronjob results in error

I am trying to run the following cronjob and I am getting the following error: /bin/sh: -c: line 0: syntax error near unexpected token `)' for the line: mysqldump --opt -Q -h localhost ...
0
votes
1answer
57 views

date and other commands no longer working in sh script

I have a shell script that used to run find on Ubuntu 10.04 but since I have moved to 12.04 it doesn't work as before throwing the following messages: /home/checks.sh: 1: /home/checks.sh: date : not ...
4
votes
3answers
207 views

How to execute a command on multiple hosts using IPv6 only?

First of all there is pdsh which is essentially a parallel distributed shell which may execute commands on a list of given hosts. However, I find myself in an IPv6 only problem setting. It seems that ...
0
votes
4answers
187 views

Sudoers file permissions

I'm trying to run the following command without the need for sudo: echo 1 | sudo tee -a /sys/block/$hd/device/delete The $hd variable changes dynamically from sdb -> sdi for each one of my HDD's in ...
4
votes
2answers
1k views

Disabling the shell of user “daemon” (/bin/false)

on a Linux system there are lot's of users by default: daemon, bin, sys, games, etc. According to my /etc/passwd most of these users have a shell assigned (/bin/sh) which seems some kind of insecure ...
3
votes
2answers
2k views

Script to run chown on all folders and setting the owner as the folder name minus the trailing /

Some numpty ran chown -R username. in the /home folder on our webserver thinking he was in the desired folder. Needless to say the server is throwing a lot of wobbelys. We have over 200 websites and ...
2
votes
2answers
500 views

Cron not running CentOS

What am I doing wrong here? Trying to set a cron job to run a shell script but it won't work. I entered the below after doing crontab -e. It does show up when doing contrab -l. 0 2 * * * root ...
0
votes
3answers
262 views

Sudo won't execute command as another user

I'm trying to get a unicorn server to start when the server boots. I've created a shell script which works if I log as the ubuntu user and run /etc/init.d/unicorn start Shell script #!/bin/sh ...
-2
votes
1answer
58 views

Rounding by 5 minute interval [closed]

How do I round it to the next 5th interval? # date Sat Oct 13 22:09:25 IST 2012 # date '+%H-%M' 22-09 the output should be 22-10 When the minute is 58 it should round to 00 and not 60 though.
2
votes
2answers
1k views

While loop read multiple lines from a grep

I'm writing a script in AIX 5.3 that will loop through the output of a df and check each volume against another config file. If the volume appears in the config file, it will set a flag which is ...
3
votes
2answers
172 views

Rename a directory containing many files

I made a mistake in a rsync and all the files are copied long with its full path. All the files that I copied are at /var/www/photos/2012/1007/1007 Attempt 1 Now I would like to fix the paths, by ...
7
votes
3answers
514 views

Custom Openssh Shell

The environment is Ubuntu Server 12.04 I would like to create a user on a server that is only able to ssh into a shell that runs tail -f on a log file and closes the session once the program ends ...
4
votes
1answer
113 views

Is it really impossible to prepend data to a tape?

I would like to keep a log of files that I am writing to tape using dd or tar for each file. Then at the end of the run, prepend that log to the beginning of the tape using dd. If it works, I can see ...
0
votes
1answer
85 views

Loading Module Into Apache - mod_wsgi

Loading Module Into Apache Once the Apache module has been installed into your Apache installation's module directory, it is still necessary to configure Apache to actually load the module. ...
1
vote
1answer
124 views

The plugin of munin is always timed out

I want to use munin to make a graph of ttyACM0 in Linux, but munin can not create the graph. I found some information in "munin-node.log". it shows that "Service 'temperature' timed out". So I changed ...
0
votes
1answer
132 views

Execute command in background and get notified when done, with time of execution

How do I make sure I get notified when the job is done? Here is what I'm running: $ time find -exec chmod o-r '{}' \+& I would like to know how long the job took and be notified when it is ...