General :: How To Log All Processes Launched And Arguments
Dec 16, 2010
I would like to get a log of all processes that are launched with the time that they were launched and the arguments they were launched with. Is this possible in Linux?
I've created a bash file that calls another bash. And I would like to get the pid from the second file launched, to wait for the file to ends. The second bash file launches processes in background. How can I get the PID from the second bash file?
I am using DreamLinux. I have pinned a program, that runs in terminal, to the launcher in the panel on desktop. The program's executable file (name: feap) is located in /home/User/feap2.2 After I added the launcher to the panel that runs the file in terminal, the program asks for the input file (text file with alot of commands) when run. By default the program accepts the files that are located in the same directory i.e. /feap2.2 , so I placed the input file in the same directory.
However when I run the program from the panel, and give the input file name, it says no such file exists. Then I gave the file name with full path, but problem was not solved. I have tried alot e.g. placed the input file at other locations, but all in vain. I have set all input file permissions to be accessible by User as well. I will be much relieved if someone suggests where to place the input file for the such program running in the terminal launched from panels?
P.S: If I open terminal, go to the directory (/home/User/feap2.2), run the program's exe file, and then give the file name, it accepts the input file and it give results.
Is there a way to configure a process to be launched in the "n"th working day? Let's say n=5. In this case, if the 5th of the month is on Saturday, then the 5th working day will be on Monday so I would like to launch the process on the 7th. The same when the 5th of the month is on Monday, it means that it's only the 3rd working day, so I would need to launch the process on Wednesday - the 7th of the month.
processArgs $* If I call this script with Code: ./script first second third it'll print each of the argument on a new line - exactly what I would expect. However if I call it with
Code: ./script "Single Argument" "Second-Argument" it splits the first argument in two using the space as a delimitor. The problem appears to be the call to processArgs, where $* doesn't honour the quotes around the variables sent to the script.
I'm using gdb to debug my program. My program requires arguments (e.g., ./prog -dfile).But if I use gdb as in gdb ./prog -dfile, gdb wants to interpret the -d argument. How do I pass an argument to my program via gdb?
How do I set ls so that when I type ls it actually runs ls -l. This Sounds minor but I'm trying to save keystrokes wherever I can. This is on Ubuntu 10.10.
I'm pretty sure this is super simple, but I've searched and searched and for the life of me I can't find any info on how to limit the columns that display in the interactive top program with arguments passed from the command line. I recall seeing something formatted like this ...
~/top -f (kdx)
Which would only show the %CPU, UID, program name fields/columns. I'd like to display the results in a really narrow terminal window on the right side of my desktop.
The script receives multiple files as parameters and it is supposed to count the number of lines in each of them and write that number in another file.
This is my script:
Code:
while [ -n "$1" ] do lines=`cat $1 | wc -l` echo "The number of lines in file $1 is $lines." >> lines.txt shift done
Is there any other way to do the same thing, without using shift?
Problem: I need a method to maintain the $i variable. In fact, actually, this variable get lost when executed. I think that an escape can preserve this variable and permit its execution inside the function, but I've no idea about.
I wrote a simple bash script to let me treat any set of programs like a deamon. For example if I configure the script a certain way I can start/stop/get the status of apache, mysql and php all from one command. I am having a bit of a problem though. I am passing commands as strings to a function and then depending on the arguments to the script it might run one of these commands or another. Some of these commands need to beun in the background though, such as deluge-web. When I send "deluge-web &" to the function and it execute it deluge-web does not start in the background. I can't figure out why this is. I have tried escaping the & with ''s and with a , but nothing seems to work. I know that this is some idiotic thing that I am overlooking, but I am a bit stumped. Here is the script configured to start/stop/get status of deluged and deluge-web.
and it gives following error Quote: ssh: myserver1..myserver2: name or service not known I basically want to pass arguments from myserver1 to myserver3 to the script.
I wanted to supply mplayer with the output of find command as arguments. The error returned showed spliced names of files whenever spaces occurred. I have subdirectories in my /home/my_user_name/Music/ directory, and in them multiple *.oga music files. The actual command that I issued was
mplayer started but then was looking for broken file names. I am thinking quoting has to do with it to preserve the filename as one string but different attempts were met with inroads:
Code: mplayer `find /home/my_user_name/Music/ -name "*.oga"` gave me the same result and Code: mplayer `"find /home/my_user_name/Music/ -name *.oga"`
I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?
(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)
I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program (there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]". Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.? (Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)
1. What file do i have to edit in order to include /usr/local/bin in the class path (ie. I put an executable in /usr/local/bin and when I try to execute it, it says the command cannot be found, etc.) EDIT: Solved, just didn't set PATH correctly. EDIT: New problem. When I try to execute a program in /usr/local/bin, it says "fopen: john.ini: File not found" Yet when i cd to /usr/local/bin, it doesn't say that. What would cause this?
2. Once I get my system setup the way i like it, how would i go about making it into a bootable CD/DVD?
3. How would I pass arguments from a shell script to a program?
I am running Squeeze (Gnome desktop) and I'm experiencing some problems with Iceweasel. My problem is that sometimes Iceweasel just hangs when I launch it. I can see the cursor blinking 2-3 times in the adress bar and then it just locks up. I have tried a few different versions of iceweasel, both from stable (squeeze though), experimental and now a package from http://mozilla.debian.net/packages/ with iceweasel 4 beta.
All of them behaves the same way. They work for a while and then suddenly locks up when launched. The only way to get going again is to kill the process and delete the .mozilla directory. It is possible to launch the --safe-mode though but nothing with this mode lets me change anything to get a normal session going.' Also, it doesn't matter if I have extensions installed or not, it still behaves the same way with zero of them installed. How would I go about to debug this? If I launch iceweasel from the command line I get no output but I'm sure there is a way to get some more info to work with.
I thought Fedora 13 could mix sound from two output sources..On my asus laptop, when music is playing and I launch skype, music stops.Just like sound stopping if I have a game running in wine.Is there a trick to allow more than one sound source?
I have a script that basically takes a list of IP addresses, and pings them to tell me if each device (Access Point) is online or not. The problem with that is, the list contains about a hundred addresses. Making the problem worse is the fact that using a single ICMP packet per device is not an option since, at certain times of the day, the network is too congested to guarantee that a single ICMP packet won't be dropped, despite the device being up and running. That means I need to send multiple pings per device for about a hundred devices. As you can imagine, doing this sequentially takes a while.
What I want to do is make my script open other threads in the background to ping multiple devices in parallel. The problem with that is - if I simply make each ping command run in parallel, soon there are a hundred background tasks, one for each address, and that consumes a lot of CPU (CPU hits 100% and stays there till the script is done). Is there a way I can make about 10 threads run at a time, and any other threads will queue until a spot opens up for them? Kind of like the token bucket, except when there aren't enough tokens, the main script waits until it can launch more background threads that ping the next addresses on the list.
Write a script that will take a list of filenames as arguments and output a count of how many of them are regular files, and how many of them are scripts (if the file is executable, it will be assumed to be a script file)
Just got a problem that I've spent a few days trying to get around. Basically, what I am trying to do is create launchers/shortcuts on my desktop that will a) Launch a terminal with root or sudo access b) Launch an application. For example, an application I might ordinarily use as a super user or root user is 'hping3.'
Basically, I want to be able to click on the launcher, and have it open up a terminal with sudo access and launch the hping3 application. I've tried messing around with the 'create launcher' function, and entering in a command to be launched in a terminal window, but to no avail (e.g. something like "sudo hping3" or "su && hping3"). How to write up a simple script to launch a terminal with su access and launch a given application?