Search Results

Search found 6936 results on 278 pages for 'shell scripting'.

Page 16/278 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • 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

  • Shell script for daily disk usage report

    - by Master
    I am doing backups on my local drives. The drives are mounted in /media folder. Now i want to run cron job daily which will tell in table format how much disk is used by folder and how much free space is left on drive It would be good if i can insert that info in database and i can see that info use webpage on locahost ubuntu 10

    Read the article

  • Process files in a folder that haven't previously been processed

    - by Paul
    I have a series of files in a directory that I need to carry an action out on using a script. Once the action is done, then I want to keep a log that the file has been processed, so that the next time the script is run, it does not attempt to carry out the action again. So lets say I can find all the files that should be processed like this: for i in `find /logfolder -name '20*.log'` ; do process_log $i echo $i >> processedlogsfile done So I have a file containing the logs I have processed, and my goal would be to modify the for loop such that these processed logs are not processed a second time. Doing a manual scan each time seems inefficient, particularly as the processedlogfiles gets bigger: if grep -iq "$i" processdlogfiles ; then continue; fi It would be good if these files could be excluded when setting up the for loop. Note that the OS in question is a linux derivative, a managment appliance, with a limited toolset (no attr command for example) and so no way to install additional utilities (well it is possible but not an option). Most common bash shell commands are available though. Also, the filenames and locations of the processed files must remain where they are - they can't be altered to reflect their processed status

    Read the article

  • What Scripting Program would you choose to recover deleted and missing files?

    - by Steven Graf
    For a private project I'm looking for a command line tool to scan and recover files. I'm working on Gnome 3 (but I could also change my OS if it helps reaching my goal) and must be able to find and recover files on attached devices with formats such as NTFS, Fat32, MAC OS Extended and ext3. Is there a command line script to cover all of them or do I need to use different programs to reach my goal? can you recommend command line tools for these kind of tasks? is one of you willing and able to show me some examples and teach me further?

    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

  • 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

  • shell tool which renders web site including javascript

    - by drholzmichl
    Hi, we want to test our webpages on linux shell. For that reason I'm looking for a shell tool, which gets the html page from server (like 'wget') and then executes contained Javascript, include pictures and so on. After this, the tool should give me a 'screenshot' of the rendered page, so that I can create a checksum for that screen. (So I want to the same as opening browser in Windows, open webpage and make a screenshot after page load, but on linux) Can anyone give me a hint?

    Read the article

  • python script argument misinterpreted in Hudson Execute Shell step

    - by chz
    When I run my python script in the shell terminal, it works sudo myscript.py --version=22 --base=252 --hosts="{'hostA':[1],'hostB':[22]}" But when I run in Hudson and Jenkins, using Execute Shell step, somehow, the string --hosts="{'hostA':[1],'hostB':[22]}" is interpreted as sudo myscript.py --version=22 --base=252 '--hosts="{'hostA':[1],'hostB':[22]}"' How do we overcome this so that our script would run in Jenkins and Hudson ? Thank you. Sincerely

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >