Search Results

Search found 4958 results on 199 pages for 'shell'.

Page 11/199 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How to execute a shell script on startup?

    - by vijay.shad
    I have create a script to start a server(my first question). Now I want it to run on the system boot and start the defined server. What should I do to get this done? My findings tell me put this file in /etc/init.d location and it will execute when the system will boot. But I am not able to understand how the first argument on the startup will be start? Is this predefined somewhere to use start as $1? If I want to have a case startall that will start all the servers in the script, then what are the options I can manage. My Script is like this: #!/bin/bash case "$1" in start) start ;; stop) stop ;; restart) $0 stop $0 start ;; *) echo "usage: $0 (start|stop|restart)" ;; esac

    Read the article

  • Retrieving a specific value from "df -h" using shell

    - by Diego Dias
    When I use df -h, I get the following output: Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 59G 2.2G 54G 4% / /dev/sda1 122M 38M 78M 33% /boot tmpfs 1.1G 0 1.1G 0% /dev/shm 10.10.0.105:/somepath 11T 8.4T 2.1T 81% /storage4 10.11.0.101:/somepath 15T 8.9T 5.9T 61% /storage1 /dev/mapper/patha 5.0T 255G 4.8T 5% /storage5_vol0 /dev/mapper/pathb 5.0T 195G 4.9T 4% /storage5_vol1 /dev/mapper/pathc 5.0T 608G 4.5T 12% /storage5_vol2 I want to write a script that gets the value of Avail column on a specific storage. I used to use df -k /storage_name | tail -1 | awk '{print $3}' But the FileSystem column can have a value or not .. which would change the variable of my script from $3 to $4. How can I get the Avail on a single command line even if there are no values on the previous columns?

    Read the article

  • linux shell utils: convert a list of hex to list of decimals

    - by osgx
    Hello How can I convert a file with a lot hex numbers into the decimal? Example: file1 0x59999 0x5acdc 0xffeff I want to start $ cat file1 | util | cat file2 and get file2 with smth like 1021489 1249230 3458080 (numbers in example output are random, as I cant convert so long hex to dec) Upd: perl : perl -pe '$_=hex;$_.="\n"'. Can anybody do it better? The real task is a sorting of hex numbers.

    Read the article

  • shell pipe behavior with MySQLDump

    - by unknown (google)
    I am using mysqldump for a large database (several GB) and import the result from a pipe, please see commands below, does it do incremental pipe, or wait until the first one finishes then import? is this a good way of importing large db across servers? I know you can export gz it, then pscp it then import. Quick alternative are welcome mysqldump -u root -ppass -q mydatabase | mysql -u root -ppass --host=xxx.xx.xxx.xx --port=3306 -C mydatabase

    Read the article

  • Shell script to fix bad filenames? [closed]

    - by Ze'ev
    I'm IT at my small firm; and, despite my dire warnings, everyone puts files on the server with awful names, including leading & trailing spaces, bad characters (including \ ; / + . < > - etc!) They do this by accessing the (FreeBSD/FreeNAS) server via AFP on Macs, so no part of the system complains. Is there a script I can use to go through an entire directory tree and fix bad filenames? Basically replace all spaces & bad ASCII with _ ... and if a file already exists, just slap a _2 or something on the end. I don't suppose there's a way to get the system to enforce good filenaming conventions, is there?

    Read the article

  • Shell script to block proftp failled attempt

    - by Saif
    Hello, I want to filter and block failed attempt to access my proftp server. Here is an example line from the /var/log/secure file: Jan 2 18:38:25 server1 proftpd[17847]: spy1.XYZ.com (93.218.93.95[93.218.93.95]) - Maximum login attempts (3) exceeded There are several lines like this. I would like to block any attempts like this from any IP twice. Here's a script I'm trying to run to block those IPs. tail -1000 /var/log/secure | awk '/proftpd/ && /Maximum login/ { if (/attempts/) try[$7]++; else try[$11]++; } END { for (h in try) if (try[h] > 4) print h; }' | while read ip do /sbin/iptables -L -n | grep $ip > /dev/null if [ $? -eq 0 ] ; then # echo "already denied ip: [$ip]" ; true else logger -p authpriv.notice "*** Blocking ProFTPD attempt from: $ip" /sbin/iptables -I INPUT -s $ip -j DROP fi done how can I select the IP with "awk". with the current script it's selecting "(93.218.93.95[93.218.93.95])" this line completely. But i only want to select the IP.

    Read the article

  • why run a Linux shell command with &?

    - by George2
    I am using Red Hat Linux Enterprise version 5. Sometimes I notice people run command with a couple of & options. For example, in the below command, there are two &-signs. What are the function of them? Are they always used together with nohup? nohup foo.sh <parameters to specific the scripe> >& <log_file_name> & thanks in advance, George

    Read the article

  • "Bootstrap" python script in the Windows shell without .py / .pyw associations

    - by PabloG
    Sometimes (in customer's PCs) I need a python script to execute in the Windows shell like a .CMD or .BAT, but without having the .py or .pyw extensions associated with PYTHON / PYTHONW. I came out with a pair of 'quick'n dirty' solutions: 1) """ e:\devtool\python\python.exe %0 :: or %PYTHONPATH%\python.exe goto eof: """ # Python test print "[works, but shows shell errors]" 2) @echo off for /f "skip=4 delims=xxx" %%l in (%0) do @echo %%l | e:\devtools\python\python.exe goto :eof ::---------- # Python test print "[works better, but is somewhat messy]" Do you know a better solution? (ie: more concise or elegant)

    Read the article

  • Which book for windows Shell programming?

    - by serefarikan
    I've been looking for a good book for windows shell programming, and the only one I could find is Visual C++ Windows Shell Programming by Dino Eposito: http://www.wintellect.com/BookInformation.aspx?ASIN=1861001843 It is an old book, and I'd like to know if you know of any good resources which could help. I need to develop a couple of windows explorer extensions, and apparently managed code is not recommended by Microsoft at least for some of these tasks. So I'm searching for a good resource for native development. Kind regards Seref

    Read the article

  • In a bash script echo shell commands

    - by user343547
    In a bash script how do I echo all shell commands called and expand any variable names? For example, given the following line: ls $DIRNAME I would like the script to run the command and display the following ls /full/path/to/some/dir The purpose is to save a log of all shell commands called and their arguments. Perhaps there is a better way of generating such a a log?

    Read the article

  • Fish Interactive Shell full path

    - by Milhous
    Is there a way in the Fish Interactive shell for the full path to be displayed. Currently when I navigate to a directory I get the following shell. millermj@Dodore ~/o/workspace but I would rather see millermj@Dodore ~/o-town/workspace

    Read the article

  • Stop execution of python script when parent Bash shell script is killed

    - by jrdioko
    I'm working on a Bash shell script that runs several Python scripts like so: cd ${SCRIPT_PATH} python -u ${SCRIPT_NAME} ${SCRIPT_ARGS} >> $JOBLOG 2>&1 At one point, I killed the shell script (using kill PID), but the Python script continued running, even after the script terminated. I thought these would die as soon as the main script died. What am I misunderstanding about Bash scripting, and what can I do to get the functionality I'm looking for? Thanks in advance!

    Read the article

  • New Application Process from Bash Shell

    - by Thomas Uster
    I'm relearning UNIX commands to use git on windows using MINGW32. When I launch a program, for example "$ notepad hello.txt" I can't use the shell again until I close the notepad file or CTRL-C in the shell. How do I essentially fork a new process so I can use both programs?

    Read the article

  • Mac OS X - run shell script from the desktop GUI

    - by dreftymac
    You can create a shell script or a Python or Ruby script and run it on the Mac by using "Terminal" ... if you have Finder open, and you click on the icon for the file containing the source code of a saved shell script, is there a way to have that script run, instead of opening in my text editor ?

    Read the article

  • read the contents of a directory using shell script

    - by jrharshath
    Hi, I'm trying to get the contents of a directory using shell script. My script is: for entry in `ls`; do echo $entry done However, my current directory contains many files with whitespaces in their names. In that case, this script fails. What is the correct way to loop over the contents of a directory in shell scripting? PS: I use bash.

    Read the article

  • How to export shell variable within perl script

    - by lamcro
    I have a shell script, with a list of shell variables, which is executed before entering a programming environment. I want to use a perl script to enter the programming environment: system("environment_defaults.sh"); system("obe"); but I when I enter the environment the variables are not set.

    Read the article

  • Run shell command from jar?

    - by phineas
    The usual way to call a shell command from java is something like that: Process process = Runtime.getRuntime().exec(command); and works usually fine. But now I've exported my project to an executable jar file and callig shell commands doesn't work any more. Are there any explanations, solutions or workarounds for this problem? phineas -- edit: even keyboard interrupts (ctrl+c; ctrl+d) aren't recognized. terminal input won't work after killing java

    Read the article

  • Multi-line code in PHP interactive shell

    - by Andrei
    I'm learning to use the PHP interactive shell, but I'm having trouble with multi-line code. Using backslashes like in the UNIX shells doesn't seem to work. What am I doing wrong ? php > function test(){\ php { echo "test";\ php { }\ php > test(); PHP Parse error: syntax error, unexpected T_ECHO, expecting T_STRING in php shell code on line 2

    Read the article

  • arbitrary input from stdin to shell

    - by python_noob
    So I have this existing command that accepts a single argument, but I need something that accepts the argument over stdin instead. A shell script wrapper like the following works, but as I will be allowing untrusted users to pass arbitrary strings on stdin, I'm wondering if there's potential for someone to execute arbitary commands on the shell. #!/bin/sh $CMD "`cat`" Obviously if $CMD has a vulnerability in the way it processes the argument there's nothing I can do, so I'm concerned stuff like this: Somehow allow the user to escape the double quotes and pass input into argument #2 of $CMD Somehow cause another arbitary command to run

    Read the article

  • Generate a random filename in unix shell

    - by R S
    Hello, I would like to generate a random filename in unix shell (say tcshell). The filename should consist of random 32 hex letters, e.g.: c7fdfc8f409c548a10a0a89a791417c5 (to which I will add whatever is neccesary). The point is being able to do it only in shell without resorting to a program.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >