Programming :: Print Command Monitoring ?
Aug 17, 2010
I am trying to write a program that monitors when an lp or basically any sort of print command is issued. If a print command is detected I want to pause that job and ask the user if he / she wants to continue.
This program would run in the background all the time so it can't sit and eat up a lot of cpu. I tried a simple while loop that continuously monitored "ps" and that obviously boosted my cpu to 100%.
View 1 Replies
ADVERTISEMENT
Mar 4, 2011
I am using an awk command to print a line from a cvs file.the awk command includes an if statement that filter the output-lets say i want to print all the lines that the price field is greater than 30.i have it working when i put the parameters myself.. but when i try to send them with vars it wont work..i am sending the sign of the if statement - can only be: == , < , >it looks like this:
cat file.csv | awk -v sign=">" -v field="2000" '{if($3 sign field) printf "%-12s%-12s%-12s%-12s
",$1,$2,$3,$4}' FS=,
the bold part is the problem , because when i put the sign parameter myself t works great.. i guess its a chars issue but i cant spot it
View 3 Replies
View Related
Jul 11, 2010
This pretend to be a script for rename a lot of files automatically. So I put the list of files in an array named @lista. But, as you can see, at the end of the command I use a sed filter to print out a backslash for those files that have spaces in their names, so the path for those files could be rightly interpreted.
But there's no way I could print a backslash. It works well when I use the Perl's sed substitution s///, but I need every path in the array to be fixed.
I'd like to add that the bash command works perfectly well alone. I mean outside the Perl script.
This is de command line with the sed filter:
Code:
And this is what it brings:
Code:
View 12 Replies
View Related
Jan 7, 2010
I have a requirement to print images (two to be precise) from the command line of a given size and without losing too much quality.
So, I may have two images, a.jpg and b.jpg which may be 4x4" and 6x4" respectively (the sizes may vary). I need to be able to print both these on a single sheet of paper (one under the other) at a given size for each - so a may be 2x2" and b may be 3x2" - the aspect ratio will always be maintained (or as near as possible!)
I am currently doing this a very messy way (because I don't know any other way!!) - basically I am converting the picture to a given size using a set density using convert and then concatenating the two using montage.
Here is part of my script:
Code:
Don't worry too much about the case statement at the end - that is just to be able to select to print either A, B or A and B.
The issue with this is that is doesn't work great if the aspect ratio is not maintained perfectly and also, it loses quite a lot of quality on the print.
I have a very old windows app which I wrote years back in VB (o dear! ) which does the same thing and the quality is fine (I am running it through wine). I want it to be command line though because I want to run it as part of other scripts etc.
View 4 Replies
View Related
May 3, 2011
I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
View 6 Replies
View Related
Mar 29, 2010
I just recently learned about the wonderful little lpr command- and using man -t (bash command) to beautifully print man pages for reference- but is there a way to print both sides of the paper using a printer so equipped?
View 2 Replies
View Related
May 5, 2009
I have a debian system installed on my pc . I have just saved a text file on my desktop . Please let me know how can i print the file through comand prompt ? I need to learn the printing the file thru comamnd line .
View 1 Replies
View Related
Jul 5, 2011
I am looking for a tool that will tell me, in less than half a second, if the microphone is picking up any sound above a certain threshold. (I plan to then mute the Master channel with another command line tool, like amixer.)
View 1 Replies
View Related
May 19, 2010
I've read up some of the posts on this forum, but can't seem to find an answer. I have a web service within an Apache Tomcat instance installed on a Redhat linux server. I only have shell access to the server, and need to monitor outbound network traffic from my web service. Is there a unix command that will allow me to monitor all outbound traffic? I'm thinking fiddler, but a unix version? I've heard of things like ntop and iptraf, but I don't think those will help me in this instance.
View 2 Replies
View Related
Apr 22, 2011
As a part of a school project I am working on monitoring context switches. I'm working on redhat 8.0, kernel version 2.4.18-14 and for some reason I keep getting unclassified reasons which causing context switches from a process to itself. I am trying to determine each context switch, what was the reason that causes it, whether time slice ended, or yielded, or went for waiting or returned from waiting or parameters changed or task ended to task forked or any possible reason.
But all the time I find that the only switches that I cannot determine the reason happens from a process to itself, all this unrecognized switches from process to itself happens only on interactive processes, and sometimes the need_resched flag is on and sometimes is off. What could possibly cause a context switch from a process to itself? Can a returning of a process with a lower (higher by number) priority from waiting cause a context switch?
View 2 Replies
View Related
Feb 4, 2011
NextPendingConnection () returns a new socket with respect to a new client. This new QSocket is passed to the connect () function which connects it to a SLOT 'xyz' with SIGNAL 'readyRead()'. Now in the SLOT 'xyz' how I am supposed to automate the monitoring of ALL connected sockets to see whether some data is available on them? One pathetic way would be to run all the sockets through a for loop and check each one of them for the data. Secondly, I read up on QSocketNotifier() here: [URL]. But I am not sure if that is the correct thing.
View 3 Replies
View Related
Apr 5, 2011
Is there any way to make program in linux machine to make report when some files have been copy to another directory or machine and knows the users who copy the files, I am planning to make this program in c, honestly first time I want to make in python when I know about pyinotify and how easy to monitoring the file in machine, but the problem is I cannot integrate that script python to know the users who do that except for the one who create the file.
View 4 Replies
View Related
Jul 11, 2011
I am trying to find a way to print PDFs from the command line. I was using "cups-pdf', but I want to be able to specify the output folder from the command line. Is there a way to do this? I guess what I am trying to do is the Gnome "Print to file" option in the terminal so I can easily print off a batch of file to whatever directory I wanted.
View 4 Replies
View Related
Dec 29, 2010
Is there a way to extract the last field? Specifying the field number is causing problems using awk or cut as the input log file has the output specified in different lines at different places/fields. The only thing constant is the 'pathname' which always occurs at the end.
View 3 Replies
View Related
Apr 29, 2010
I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?
View 4 Replies
View Related
May 27, 2010
I am looking for a way to print the timestamp of a directory using find command. I can do that for a file, but for a directory, it is printing the contents of the directory as well. Lets say there is a directory called doc, and there are more than one occurrences of that directory.
find . -name "doc" -type d -exec ls -l {} ;
This is printing the contents of all the files under doc directory as well.
View 3 Replies
View Related
Aug 15, 2010
When running certain programs (i.e. Nedit or Gourmet Recipe Manager) asking to print will give the following message: Enter print command:
Am using 13.1 32 bit with cups. Everything works properly and prints properly I just don't know what to enter for a 'print command'.
Have tried entering lpr and cups.
View 3 Replies
View Related
Jul 5, 2011
1. lp file_with_english_chinese2. lp -ozh_CN.utf8 file_with_english_chineseThe normal ascii characer prints ok but the chinese character are blank.
View 4 Replies
View Related
Apr 27, 2010
how to use multiple linux cut comman to display on same line ?
e.g ls -il | cut -f6 d:
ls - il cut -f9 -d:
The linux script output is
filename
123
How to use cut to display on same line ?
View 1 Replies
View Related
Jun 15, 2011
I am writing an expect script and I want to send the command for the print-screen function. So, what is the command? Alternatively, is there some terminal application which may be well suited to take screen-shots via commands from the terminal or automation scripts?
View 2 Replies
View Related
Jan 24, 2011
I'm hoping this is the right category. Is there a terminal command to display what network you're currently connected to?
Example:
My home network's name is (in this example) "home".When connected to it, I want a command that, when run, would give me the output 'home'. Does such a command exist?
View 1 Replies
View Related
Jan 29, 2010
I am just trying to print the timestamp. which is not working.
#!/bin/bash
TSTAMP= date '+%d.%m.%y-%H:%M:%S'
echo "${TSTAMP}"
It is not displaying anything. What is wrong with the above commands.
View 3 Replies
View Related
Oct 6, 2009
I work at The University of Alabama as a sysadmin on various HPC resources and also provide support for faculty using Unix systems. I've run into one problem that is affecting two different desktop systems running CentOS 5.3.oth of these systems have the latest updates. These machines have standard network-attached printers. One is an HP LaserJet 3250 and the other is a model that is pretty close to that one.Previously these users were able to print from graphical applications such as Firefox, but now when the print dialog is opened on ANY graphical application, it causes a hard freeze on that particular app.Printing from the commandline via `lpr` gives no issues and test pages from the Printer Admin interface also succeed.This problem has me stumped, so I'm looking for any insight as to what could have changed. I do not know what changed between the time when the printers worked graphically and when they stopped, but the users assure that they have changed no settings. The only thing I can suspect is a rogue update since this is affecting separate users on separate machines with separate printers.
View 4 Replies
View Related
Jun 24, 2010
I want to print NaN value in a file containing of 3600 rows and 7 columns.The illustration of output file which I want to is as follows :
NaN NaN NaN NaN NaN NaN NaN (the first row)
NaN .... NaN
.
.
.
NaN .... NaN (the 3600 rows)
I tried to use below command
awk 'BEGIN {for(i = 1; i <= 3600; i++); printf "%s", "NaN", $1" "$2" "$3" "$4" "$5" "$6" "$7}' > output
Unfortunately, I couldn't get what I want to.
View 6 Replies
View Related
Sep 7, 2010
I loaded FED 13 and running kernel 2.6.34.6-47 fc13, Now back from holiday, I'm trying without success to sort out a few problems. 1 can not print. the printer sets up OK epson R285, but can't print test pages or from any app, or from CLI with lpr command. Cups log shows this:-
[Code]....
View 1 Replies
View Related
Dec 3, 2010
I want to print Landscape and I would normally use Code: lp -ddestination -olandscape However this isn't working, it could be another problem (I am passing to a windows print spooler) but I would like to know if I have got the command right.
View 1 Replies
View Related
Oct 11, 2009
Is it possible to print the permission in octal format for a directory recursively?Code:
stat -c "%a" /etcIt prints the permission for /etc directory only.
View 2 Replies
View Related
Dec 21, 2010
How to print a sequence of line say line number 10 to 20 of a 50 line file ?
View 6 Replies
View Related
May 3, 2011
Let's say I am pinging a host, and want to output to a file each reply and its timestamp of when this started.
I know that it can be done with a loop and a shell script. Something like this
DO
echo "$(date)" >> results.txt ###includes the time and outputs results to txt###
ping -c 4 HOST >> results.txt ###a total of 4 pings at a rate of 1 per second###
REPEAT UNTIL USER PRESSES CTRL-C
Now, my first issue is that I need to be able to see results real-time as well.
Is there a way one can print to BOTH a screen and output? If one uses the ">>" command, it is essentially sending everything to the file. Running another ping command in parallel is not an option.
View 3 Replies
View Related
Apr 12, 2010
I have this code:
How can I print &FARAchieved to a file? Or, printing the whole bioReturn would be fine too.
View 8 Replies
View Related