Programming :: Embedding Command In Jython Script?
Jan 28, 2010
I am trying to embed a command in a Jython script. The version of jython does not support popen so I am using os.system("pmap -x %s | tail -n1 |cut -f2 -dB" % (pid)) to get the memory consumption of a pid and pass same into my Jython script. The problem is that my code which looks like this:
executes properly but does not assing the result into the variable "memusage". So when I used the variable elsewhere I get "0". How do I manage to get the variable to grab this value rather than it executing directly.
I am having a streaming server Red5 running on localhost. I have a few HTML pages which should be serving those streams.
I read documentation given here [url] and [url]and the swfobject.js and player.swf are on same directory where the test.html page I created is present.
Following is the HTML code Red5 is working on localhost.
I have Ubuntu 10.04 and i am taking a programming class and I can not figure out how to get this to work.I downloaded JES from linux and I do not know what to do from there
I have question about embedding existing mysql data to FTP. Let me tell you how the system works. Apache gets the user name and passwords records to the MYSQL and creates a folder per user in server. However users can not access their created folder using FTP client software. So how am I gonna merge the existing user/password data in MYSQL ---> to the FTP user/password. Vsftpd and proftpd installed already, so in whichever you feel more knowledgeable, I can go with that.
I lost my capability to boot into any OS for some reason. I am dual booting Windows 7 and Ubuntu 10.10 and I have managed to restore my Windows bootloader using a Windows repair disk.I have tried to reinstall Grub using these commands from a Ubuntu Live CD:
Code:
ubuntu@ubuntu:~$ sudo mount /dev/sda6 /mnt ubuntu@ubuntu:~$ sudo grub-install --root-directory=/mnt /dev/sda
The latter gives this output:
Code:
/usr/sbin/grub-setup: warn: Your embedding area is unusually small. core.img won't fit in it.. /usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.. /usr/sbin/grub-setup: error: if you really want blocklists, use --force.
Here are the results from the boot info script:
Code:
Boot Info Script 0.55 dated February 15th, 2010 ============================= Boot Info Summary: ============================= => Windows is installed in the MBR of /dev/sda sda1: _________________________________________________________________________ File system: ntfs
[code]....
PS. I probably should mention that I edited the partitions prior to these problems, moving the extended sda3 to the left to give it some more space. The order of the partitions remained unchanged.
I would like to backup my entire Ubuntu installation (/boot, swap and /) at /dev/sda (4GB) to /dev/sdb (10GB).I recreated the exact partitions on /dev/sdb, formatted and cp -rp all the files over.For /boot, I used
Code:
dd if=/dev/sda1 of=/dev/sdb1
It didn't boot successfully as the system kept rebooting. I then tried to install grub onto the MBR and boot partition (mounted at /mnt/tempboot).
$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?
I am trying to learn how to pass more than a one-command startup for gnome-terminal.
I will give an example of what I'm trying to do here:
Code: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ${0##*/} [-x] [-g] code....
However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.
This same error occurs if the gnome-terminal line is changed to
Code: gnome-terminal -e mcTerm
Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.
I am trying to grep multiple numbers from file, grep does have the -f option for that.
Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with
Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?
Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).
What's the deal with this bloody commandI trying to do an update of a product.The -f is suppose to "force" the overwrite of existing files isn't it?Well every time I run the command it keeps asking me to allow it to overwrite the files.. the programs is too long for me to sit here hitting the "y" and "enter key"
I have a script that will build a list of hosts and it works fine Code: for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; done But I need it to build the START and END on different number formats (i.e. 1 -> 10, 01->10, 001 ->010)
I am trying to use the seq command but can't get it to work quite right with the -w flag in the following Code: for ((myseq=$START; myseq<=$END; myseq ++)) do echo "$NAME${myseq}" done I am fully aware that this syntax is probably wrong, and need to know how to correct it.
Is anyone familiar with the Minix OS? i want to know what is the Process to add a new command in Minix that uses system call served by the memory manager server
I have many processes running that printf local debug. (they will log to file later!) I start them by
Code: ( sleep 20000000 | fp ) & else they get killed/stop by themselves. So now its running in the background, I want to bring it to the front to see the printfs.
I did a search for this but did not see anything relevant.I'm trying to join several strings and execute them as a command but csh does not seem to recognize it as a command, anyone know what I'm doing wrong? numone and numtwo will be passed into the script. (I have to use csh because it is a part of an existing script.)
it dosent work though i originally started off with
Code:
words=`cat /usr/share/dict/words |grep "^[$list]*$" | xargs -n 6 echo | sed -e 's/[ ]+/,/g' this puts a comma inbetween them but takes out the space and dosent put a comma at the end of the line.. basicaly what i needed to know is how i could you multiple sed commands to fix this
How would I create a sed or awk command that would add a | to the end of a line if it wasn't already there? I'm trying to import some files into mysql, but some of the lines to not end with a | which is my field delmiter.
i'm trying to execute a shell script, i'm trying to use the values in an array for use in a sed command:
sed -n '/Sales ID: ${array[$i]}/,/Totals:/p'
that command creates empty files. so my guess is that its not recognizing the array as an array but as text? how would i be able to utilize the array in the command? i got it, didnt think that if i doubled up the single quotes that it would work, but this worked:
Code: Select allapt-get install icedove-l10n-hu apt-get install rar apt-get install ... ... y press key or other language is other key. hungarian key is: i
english after apt-get install in gnome-terminal: (y)es or (n)o hungarian after apt-get install in gnome-terminal: (i)gen or (n)em
How to yes or no automatically in all languages? Not manual, not 'Y'/'I' or 'N'/'N' keydown.
I would like use this script my fresh installed Debian 7.1. I would like run this install.sh when Debian is installed for my all softwares when i would like use.
I use udhcp with some of my minimal installs. I've messed around with the code a bit when it wasn't working correctly - a few years ago. I will find time - I hope soonish - to figure out how to do a few other things with it.
For now though, I'm using this string to grab my ip after startup
I realize I could substitute ifup -a but I'm more interested in figuring out how to make ifup wait for the ip to become available if it is not available yet.
Never mind that one, just typing out the question answered it for me, when I find it in the scripting man ' ; : " & =
Or if there are any other suggestions for better construction of the string.