Search Results

Search found 6758 results on 271 pages for 'shell exec'.

Page 50/271 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • How to write to a file and, while the file is still being writen, read and parse its contents using

    - by Isabelle
    Hello. I'm actually trying to write a shell script that logs the output of a command to a file but, since the command takes a long time to complete (about 15 minutes), I would like to start parsing the output of the command (content of the file) before the command is completed, so I can send messages to the standard output (the user), like: 10% complete 45% complete and so on. Program steps Redirect command to a file: $(command) $FILE Start reading and parsing the output ($FILE) before the command is finished. I thought of using pararell programming, but I havent't got the hang of it. Any help you be appreciated. Best regards.

    Read the article

  • How do I setup a Gnome 3.2 VPN connection (Fedora 16)

    - by mpeters
    I just switched to Gnome 3 on a new laptop to try it out. Lots of things are different, but I think I can get used to them. But I'm having a real problem trying to figure out how to get the new network manager to setup a VPN through the GUI. I have openvpn, NetworkManager and NetworkManager-openvpn installed, but when I click on the network icon in gnome-shell there is nothing about vpn connections in there. When I click the "Network Settings" link in that menu I just see menus for Wired, Wireless and Network Proxy and none of those screens has anything for VPN connections either. Any suggestions about where I need to look to setup my connections and how to make it easier connect when I need to?

    Read the article

  • grep with after-context that does not contain a keyword

    - by ukasz
    I want to grep through logs, and gather a certain exception stacktrace but I want to only see those that do not contain certain keywords in --after-context. I do not know in which line in after-context the keyword is. Simple example - given this shell code: grep -A 2 A <<EOF A B C R A Z Z X EOF the output is: A B C -- A Z Z I'd like the output to be: A Z Z I want to exclude any match that has 'B' in after-context How do I do this? Using grep is not a requirement, though I only have access to coreutils and perl.

    Read the article

  • Looking for Primos "name generation" code

    - by Greg E
    Anyone remember Primos ? It had a shell-level thing called "name generation" which was very useful. Eg. to rename a bunch of files from part1.suffix to part1.new.suffix2 you could say rename *.suffix =.+new.suffix2 That's a very simple example, it was quite powerful. The control characters were: =,==,^=,^==,+ Which meant approximately: match 1 filename component, match all remaining components, delete one component, delete all remaining, add a component. In conjunction with Primos wildcards you could do pretty much any useful file renaming/copying operation very conveniently. It was much better than Unix wildcards and name generation/iteration and I'd like to find it again and use it. Anyone seen it around ? Not much reference on the interweb: search "Primos name generation" and you get a few fragmentary hits. Thanks !

    Read the article

  • Privileged command as part of cronjob

    - by user42756
    Hi, I'm facing a weired problem on a unix-based machine. Here is the story: I have a personal username/password on a unix machine with limited privileges. Whenever I need to execute some commands I have to substitute user using the su command, then I execute it normally. Now, I need to add a cronjob that uses such privileged commands so I added the cronjob on the crontab of the user I substituted to in order to have access to these commands. Strangely, it turned out to me that these commands fail to run for some reason as a cronjob although when I execute them directly from shell (after su) they work seamlessly. Why does this happen? Why do these commands not work as part of cronjobs? Thank you

    Read the article

  • Migrating users and mailboxes from postfix / Maildir to Postfix with Mysql backend [closed]

    - by Chrispy
    Possible Duplicate: Migrating users and mailboxes from postfix / Maildir to Postfix with Mysql backend So I've got 60 or so users on a hand rolled postfix installation on openbsd and I'd like to move their mailboxes to our new mail server running iRedMail (postfix, vmail/mysql back end) Does anyone know of a good way to do this? Preferably a script I can run to keep syncing the users mailboxes as MX records get updated? I presume one way (though I don't have all their passwords!) would be to have a command line imap client that simulated the users copying their mail themselves but I'm sure there must be a shell / php script to migrate users? Anyone got any bright ideas? Chris.

    Read the article

  • ssh freezes when trying to connect to some hosts

    - by NS Gopikrishnan
    When I try to ssh to particular machine/s in a list, The SSH command happens to be freezing. I tried out setting ssh timeout. But then also it's freezes even after the timeout. In verbose mode : OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to x358.x.server.com [10.x.x.x] port 22. debug1: fd 3 clearing O_NONBLOCK debug1: Connection established. debug1: identity file /export/home/sqlrpt/.ssh/identity type -1 debug1: identity file /export/home/sqlrpt/.ssh/id_rsa type -1 debug1: identity file /export/home/sqlrpt/.ssh/id_dsa type 2 At this point it freezes. A work around I thought was to create a child process for each ssh calls and if the process doesn't respond after a timeout - Kill it. But are there any less complex ways, so that I can accommodate it in a shell script itself rather than going for a C/C++ program ?

    Read the article

  • Tabbed terminal that connects to a GNU Screen session?

    - by screenuser
    I use the session feature of screen extensively. For example, I'll start a screen session for "project1" as "screen -S project1", and then when I need to reconnect I use "screen -d -r project1". This makes it easy to manage multiple projects, each with their own set of shell sessions. What I would love to do now is that when running on Windows and Linux, to be able to use a tabbed terminal program (such as gnome-terminal) to connect to a screen session and have all of the screen windows split out to separate tabs. This way I get all the usual power of screen, but with the convenience of a richer GUI experience. Is there any such terminal program available on Windows and/or Linux?

    Read the article

  • Timeout ssh sessions after inactivity?

    - by Insyte
    PCI requirement 8.5.15 states: "If a session has been idle for more than 15 minutes, require the user to re-enter the password to re-activate the terminal." The first, and most obvious, way to deal with ssh sessions that are idling at the bash prompt is by enforcing a read-only, global $TMOUT of 900. Unfortunately, that only covers sessions sitting at the bash prompt. The spirit of the PCI spec would also require killing sessions running top/vim/etc. I've considered writing a */1 cron job that parses the output of "/usr/bin/w" and kills the associated shell, but that seems like a blunt instrument. Any ideas for something that would actually do what the spec requires and just lock the terminal? I've looked at away and vlock; they both seem great for voluntarily locking your terminal, but I need a cron/daemon task that will enforce locking.

    Read the article

  • Comparison of Unix shells

    - by Andy White
    Of the major Unix shells (bash, ksh, tcsh, zsh, others?), are there any compelling reasons to use one over another? Which is the most interactive/command-line friendly? Which is the most conducive/intuitive for writing scripts? Are there any major built-in features that one shell offers that others don't? Are any of these shells really good for one type of function, but not another? Or are they all pretty well-rounded/flexible? Is it just a matter of personal preference? I can make this community wiki if anyone prefers.

    Read the article

  • determine the archetecture of a mac from the command line or script?

    - by Brian Postow
    I'm writing a shell script, and I need to know the archetecture, ie PPC or Intel. Back in the day, there was a program /bin/arch that told you, but my mac doesn't seem to have it... Is there an easy way I can do this? Grep for something in a logfile? call some other program that spits that out as a side effect? It would be nice to know what OS Version I'm running too, but that may not be necessary. thanks

    Read the article

  • Need help creating a batch file to replace "." with "-"

    - by Brandon Ogle
    Like the title says, I need help creating a batch file to replace "." with "-", however I need to perserve the file extensions and it needs to work through the subfolders. I found another post on here that got the effect I wanted but it also swapped the . in my file extensions. I am a completely ignorant regarding shell script so please be detailed in your response. I have no idea what any of the switches mean or even how to specify the path for that matter. Thanks!

    Read the article

  • Stream tar.gz file from FTP server

    - by linker
    Here is the situation: I have a tar.gz file on a FTP server which can contain an arbitrary number of files. Now what I'm trying to accomplish is have this file streamed and uploaded to HDFS through a Hadoop job. The fact that it's Hadoop is not important, in the end what I need to do is write some shell script that would take this file form ftp with wget and write the output to a stream. The reason why I really need to use streams is that there will be a large number of these files, and each file will be huge. It's fairly easy to do if I have a gzipped file and I'm doing something like this: wget -O - "ftp://${user}:${pass}@${host}/$file" | zcat But I'm not even sure if this is possible for a tar.gz file, especially since there are mutliple files in the archive. I'm a bit confused on what direction to take for this, any help would be greatly appreciated.

    Read the article

  • Determine the architecture of a Mac from the command line or script?

    - by Brian Postow
    I'm writing a shell script, and I need to know the archetecture, ie PPC or Intel. Back in the day, there was a program /bin/arch that told you, but my mac doesn't seem to have it... Is there an easy way I can do this? Grep for something in a logfile? call some other program that spits that out as a side effect? It would be nice to know what OS Version I'm running too, but that may not be necessary. thanks

    Read the article

  • Pop current directory until specific file is found

    - by edarroyo
    I'm interested in writing a script with the following behavior: See if a file, build.xml, exists in the current directory, if so run a command supplied through arguments to the script. If not, pop the current directory and look at the parent. Go to 1. The script would end once we find the file or we reach the root. Also, once the script finishes and control comes back to the user I want the current directory to be that one where the script was initially l I'm not very familiar with shell scripting but any help/guidance will be much appreciated.

    Read the article

  • How to run a command in a process that is not a child of the current process?

    - by amicitas
    I am having a library conflict issue with calling an external program from within a interpreted programming environment (IDL). The issue seems to be that since the program I am calling ends up as a child of IDL, libraries are not being reloaded. From within IDL I can launch sub-processes either directly or using a shell. Is there a good way that I can cause my program to be run without ending up as a child process? The only solution I have found so far is to use ssh localhost my_program. This works perfectly but I would like a more direct solution.

    Read the article

  • Different behaviour of script locally and over ssh

    - by neorg
    I have a script on a server-A Script-A #!/bin/bash -l echo "script-A.sh" | change-environment.sh When I ssh onto server-A and execute it, it works fine. However, when I ssh user@server-A ./script-A.sh Script-A executes, but throws an undefined variable error in change-environment.sh. change-environment.sh runs in the c shell(I have no control over the script so the method I have used is about the only way I can use it), but everything else is in bash. Had found a similar question at I can run a script locally, but cannot do "ssh HOSTNAME /path/to/script.sh". However, there was no solution to the issue and it was a year old.

    Read the article

  • Use alias source with relative path

    - by notme
    I want to add an alias file to my project folder to quickly open and edit files in it with a simple shell command. To make it more portable, I would like to use only relative paths. I want something like this: ### .profile source /my/project/folder/aliases.bash and ### aliases.bash editprojectfiles="edit [/my/project/folder/]afile.txt" The problem for me now is how to retrieve [/my/project/folder/] automatically. I tried to use $PWD variable, but the result is that the alias points to the folder of .profile file and not the aliases.bash ones. Is there a way to get this?

    Read the article

  • Xubuntu 12.04: Slow Login

    - by naxchange
    I'm running Xubuntu 12.04, and after I ran the update, my login started slowing down big time. I've dabbled a little bit with the programs in Settings - Settings Manager - Session and Startup, and tried closing and opening these programs, and then rebooting. Anyways, I narrowed it down to a combination of 2 processes, "Network" (the connection manager) and "Xfce Volume Daemon". Their corresponding terminal commands are: ~$ nm-applet ~$ xfce4-volumed If I disable them, and then run them after login is complete, everything works just fine. Is there a way for me to run these commands automatically at start up? I want to maybe write a shell script and save it somewhere, or at least edit the order things happen after login, so the desktop can load before these processes. Hope I've been clear enough, and thanks in advance! NAX

    Read the article

  • Run bat file in Java and wait 2

    - by Savvas Dalkitsis
    This is a followup question to my other question : http://stackoverflow.com/questions/2434125/run-bat-file-in-java-and-wait The reason i am posting this as a separate question is that the one i already asked was answered correctly. From some research i did my problem is unique to my case so i decided to create a new question. Please go read that question before continuing with this one as they are closely related. Running the proposed code blocks the program at the waitFor invocation. After some research i found that the waitFor method blocks if your process has output that needs to be proccessed so you should first empty the output stream and the error stream. I did those things but my method still blocks. I then found a suggestion to simply loop while waiting the exitValue method to return the exit value of the process and handle the exception thrown if it is not, pausing for a brief moment as well so as not to consume all the CPU. I did this: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Test { public static void main(String[] args) { try { Process p = Runtime.getRuntime().exec( "cmd /k start SQLScriptsToRun.bat" + " -UuserName -Ppassword" + " projectName"); final BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); final BufferedReader error = new BufferedReader(new InputStreamReader(p.getErrorStream())); new Thread(new Runnable() { @Override public void run() { try { while (input.readLine()!=null) {} } catch (IOException e) { e.printStackTrace(); } } }).start(); new Thread(new Runnable() { @Override public void run() { try { while (error.readLine()!=null) {} } catch (IOException e) { e.printStackTrace(); } } }).start(); int i = 0; boolean finished = false; while (!finished) { try { i = p.exitValue(); finished = true; } catch (IllegalThreadStateException e) { e.printStackTrace(); try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } } } System.out.println(i); } catch (IOException e) { e.printStackTrace(); } } } but my process will not end! I keep getting this error: java.lang.IllegalThreadStateException: process has not exited Any ideas as to why my process will not exit? Or do you have any libraries to suggest that handle executing batch files properly and wait until the execution is finished?

    Read the article

  • PySide Qt script doesn't launch from Spyder but works from shell

    - by Maxim Zaslavsky
    I have a weird bug in my project that uses PySide for its Qt GUI, and in response I'm trying to test with simpler code that sets up the environment. Here is the code I am testing with: http://stackoverflow.com/a/6906552/130164 When I launch that from my shell (python test.py), it works perfectly. However, when I run that script in Spyder, I get the following error: Traceback (most recent call last): File "/home/test/Desktop/test/test.py", line 31, in <module> app = QtGui.QApplication(sys.argv) RuntimeError: A QApplication instance already exists. If it helps, I also get the following warning: /usr/lib/pymodules/python2.6/matplotlib/__init__.py:835: UserWarning: This call to matplotlib.use() has no effect because the the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. Why does that code work when launched from my shell but not from Spyder? Update: Mata answered that the problem happens because Spyder uses Qt, which makes sense. For now, I've set up execution in Spyder using the "Execute in an external system terminal" option, which doesn't cause errors but doesn't allow debugging, either. Does Spyder have any built-in workarounds to this?

    Read the article

  • select failing with C program but not shell

    - by Gary
    So I have a parent and child process, and the parent can read output from the child and send to the input of the child. So far, everything has been working fine with shell scripts, testing commands which input and output data. I just tested with a simple C program and couldn't get it to work. Here's the C program: #include <stdio.h> int main( void ) { char stuff[80]; printf("Enter some stuff:\n"); scanf("%s", stuff); return 0; } The problem with with the C program is that my select fails to read from the child fd and hence the program cannot finish. Here's the bit that does the select.. //wait till child is ready fd_set set; struct timeval timeout; FD_ZERO( &set ); // initialize fd set FD_SET( PARENT_READ, &set ); // add child in to set timeout.tv_sec = 3; timeout.tv_usec = 0; int r = select(FD_SETSIZE, &set, NULL, NULL, &timeout); if( r < 1 ) { // we didn't get any input exit(1); } Does anyone have any idea why this would happen with the C program and not a shell one? Thanks!

    Read the article

  • Unable to add FromName to e-mail using cdosys in SQL Server 2008

    - by Alex Andronov
    I have a piece of cdosys code which runs correctly and generates e-mail with my SQL Server 2008 server talking to a MS Exchange 2003 Server. However the from name is not appearing on the e-mails when they arrive. Is there a fault in the code is it not possible this way? Thanks in advance usp_send_cdosysmail @from varchar(500), @to text, @bcc text , @subject varchar(1000), @body text , @smtpserver varchar(25), @bodytype varchar(10) as declare @imsg int declare @hr int declare @source varchar(255) declare @description varchar(500) declare @output varchar(8000) exec @hr = sp_oacreate 'cdo.message', @imsg out exec @hr = sp_oasetproperty @imsg, 'configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").value','2' exec @hr = sp_oasetproperty @imsg, 'configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").value', @smtpserver exec @hr = sp_oamethod @imsg, 'configuration.fields.update', null exec @hr = sp_oasetproperty @imsg, 'to', @to exec @hr = sp_oasetproperty @imsg, 'bcc', @bcc exec @hr = sp_oasetproperty @imsg, 'from', @from exec @hr = sp_oasetproperty @imsg, 'fromname','A From Name' exec @hr = sp_oasetproperty @imsg, 'subject', @subject -- if you are using html e-mail, use 'htmlbody' instead of 'textbody'. exec @hr = sp_oasetproperty @imsg, @bodytype, @body exec @hr = sp_oamethod @imsg, 'send', null -- sample error handling. if @hr <>0 select @hr begin exec @hr = sp_oageterrorinfo null, @source out, @description out if @hr = 0 begin select @output = ' source: ' + @source print @output select @output = ' description: ' + @description print @output end else begin print ' sp_oageterrorinfo failed.' return end end exec @hr = sp_oadestroy @imsg

    Read the article

  • Processing a log to fix a malformed IP address ?.?.?.x

    - by skymook
    I would like to replace the first character 'x' with the number '7' on every line of a log file using a shell script. Example of the log file: 216.129.119.x [01/Mar/2010:00:25:20 +0100] "GET /etc/.... 74.131.77.x [01/Mar/2010:00:25:37 +0100] "GET /etc/.... 222.168.17.x [01/Mar/2010:00:27:10 +0100] "GET /etc/.... My humble beginnings... #!/bin/bash echo Starting script... cd /Users/me/logs/ gzip -d /Users/me/logs/access.log.gz echo Files unzipped... echo I'm totally lost here to process the log file and save it back to hd... exit 0 Why is the log file IP malformed like this? My web provider (1and1) has decide not to store IP address, so they have replaced the last number with the character 'x'. They told me it was a new requirement by 'law'. I personally think that is bs, but that would take us off topic. I want to process these log files with AWstats, so I need an IP address that is not malformed. I want to replace the x with a 7, like so: 216.129.119.7 [01/Mar/2010:00:25:20 +0100] "GET /etc/.... 74.131.77.7 [01/Mar/2010:00:25:37 +0100] "GET /etc/.... 222.168.17.7 [01/Mar/2010:00:27:10 +0100] "GET /etc/.... Not perfect I know, but least I can process the files, and I can still gain a lot of useful information like country, number of visitors, etc. The log files are 200MB each, so I thought that a shell script is the way to go because I can do that rapidly on my Macbook Pro locally. Unfortunately, I know very little about shell scripting, and my javascript skills are not going to cut it this time. I appreciate your help.

    Read the article

  • What's a good way to write batch scripts in C#?

    - by Scott Bilas
    I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example). I'm familiar with command line "scripting" wrappers like AxScript so that gets me part of the way there. What I'm missing is the easy file-manipulation framework. I want to be able to do cd(".."), copy(srcFile, destFile) type functionality. Tools I have tried: NANT, which we use in our build process. Not a good scripting tool. Insanely verbose XML syntax and to add a simple function you must write an extension assembly. Can't do it inline. PowerShell. Looks great, but I just haven't been able to switch over to this as my primary shell. Too many differences from 4NT. Whatever I do needs to run from an ordinary command prompt and not require a special shell to run it through. Can PowerShell be used as a script executor? Perl/Python/Ruby. Really hate learning an entirely new language and framework just to do batch file operations. Haven't been able to dedicate the time I need to do this. Plus, we're a 99% .NET shop for our toolchain and I really want to leverage our existing experience and codebase. Are there frameworks out there that are trying to solve this problem of "make a batch file in C#" that you have used? I want the power of C#/.NET with the immediate-mode type functionality of a typical cmd.exe shell language. Am I alone in wanting something like this?

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >