General :: ImageMagick's "import" Command Line Program Failing To Take A Screenshot From CRON Script
Feb 16, 2011
I wrote a simple command line script which is suppose to take my screenshot every 5 minutes.(using ImageMagick's "import" program)
Here is the script (shottr.sh):
This is working fine if I execute by hand i.e:
The script itself is being executed (I hear a voice saying: "Screenshot") but the actual screenshot is not taken.
Be assured that it is NOT permission issue (I placed a simple "touch" invocation and file was created)
May be if it's run from cron...it doesn't have a "window" so it can't take a screenshot from nowhere? If that is the case, then how can I workaround it?
To take a screenshot(or partial screenshot), I use to use the command-line, type "import <filename>.png" and then "alt-tab" away from the console (for me, xterm) and then (usually) select a part of the webpage showing up on the browser. However, I find in my modern X-window installations (I use osuse and slackware, with several window managers: xfce, icewm and awesome) the alt-tabbing bit doesn't work any more.To get by, I have to reduce the size of the console so that the bit I want to capture is visible as I write the import commandI figure this is an X problem, but it could also be an imagemagick problem (on that subject, I think I'm going to try out graphicsmagick soon)
I use a program which makes a large image which I have to scroll to view. The program has no way to save the image, and I have no access to the source to modify it. The only way I have to get the image from the program is by screenshot. My goal is to save the full size image without having to piece together individual screenshots. I'm using this script to try taking a screenshot:
This uses wmctrl to get the window id ($window) for a window named "Program". It then tries to resize the window to the desired dimensions. It uses imagemagick (import) to save a screenshot.png on the user's Desktop. All of this works except the resize step. I can resize the window using wmctrl -r -e, but sizes greater than the screen size don't work. I'm using Ubuntu 10.04 and the Gnome Desktop. I run two monitors, but I've tried this with one of them disabled. Is there a way to resize the window larger than my screen to get a huge screenshot?
Part II: I tried using xrandr to set up screen panning, so as to have a bigger desktop than my monitor. xrandr --output LVDS --panning 2600x2500 This command makes the laptop screen pan over a 2600x2500 size desktop, even though it can only show 1440x900 at one time. To turn off the panning, I can use a similar command to set total size and with zeroes for the panning section. This gives me back my original laptop display behavior. xrandr --fb 1440x900 --output LVDS --panning 0x0 This is all done with xrandr, and does not require any Xorg.conf changes (my Ubuntu system doesn't even have an Xorg.conf).
My video card seems to only allow about 6.5 million pixels, even though the maximum dimensions are 8192x8192. That maximum seems to be the maximum for either dimension, but there is a limit to how many pixels can be drawn, which is the width multiplied by the height. Once I did the screen resize, I tried my script again and got a screenshot. The screenshot however is totally scrambled. I'm not sure if it's unable to take a screenshot of an off-screen window or if it is unable to handle the large dimensions of the window. With the panning display, the window should think it is visible, and the window manager should think it is on-screen. So there is a pixel buffer somewhere with those pixels in it, so there should be a way to get a screenshot.
simple scan error as follows: Failed to save file ImageMagick returned error code 11 Command line: convert -adjoin /tmp/simple-scan-DA9MBV.jpg /tmp/simple-scan-XCK4BV.jpg /tmp/simple-scan-NZVYBV.pdf Stdout: Stderr: using karmic note: I have apparmor extra profiles installed but didn't notice one that related to simple scan or imagemagick. Red herring or not?
I have the following shell: export PATH=/u01/app/oracle/product/10.2.0/db_2/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin ftp -u -v -n -i > /bk01/exports/FTP_OUTPUT.LOG <<EOF open 197.0.0.78 user orabackup orabackup cd /media/disco/BK_Oracle bin put FILE00001.LOG put FILE00001.DMP quit EOF
Executing the shell from command line, the output is: Connected to 197.0.0.78. 220 Bienvenido al servicio FTP del servidor backup. 530 Please login with USER and PASS. 530 Please login with USER and PASS. 331 Please specify the password. 230 Login successful. 250 Directory successfully changed. 200 Switching to Binary mode. local: EXPO_APOT10G_20100531.LOG remote: EXPO_APOT10G_20100531.LOG 227 Entering Passive Mode (197,0,0,78,200,162) 150 Ok to send data. 226 File receive OK. 127498 bytes sent in 0.0022 seconds (5.7e+04 Kbytes/s) local: EXPO_APOT10G_20100531.DMP remote: EXPO_APOT10G_20100531.DMP 227 Entering Passive Mode (197,0,0,78,175,141) 150 Ok to send data. 226 File receive OK. 458190848 bytes sent in 6.1 seconds (7.3e+04 Kbytes/s) 221 Goodbye.
Executing the shell from cron, the output is: Connected to 197.0.0.78 (197.0.0.7. 220 Bienvenido al servicio FTP del servidor backup. 331 Please specify the password. 230 Login successful. 250 Directory successfully changed. 200 Switching to Binary mode. local: EXPO_APOT10G_20100531.LOG remote: EXPO_APOT10G_20100531.LOG local: EXPO_APOT10G_20100531.DMP remote: EXPO_APOT10G_20100531.DMP 221 Goodbye.
Why from cron the output no show the statistics in red ...?
For whatever reason, the "Ctrl-Alt-Fn" sequence has no effect on one of my Ubuntu machines; the sequence is interpreted as ordinary input. I need to get the system to a console because I'm trying to do a dist-upgrade and that's going to bounce gdm etc.
Is there some command-line tool that can be used to switch consoles? I have some vague distant memory of that being possible.
(I'm running Ubunty Jaunty at the moment. Yes I know it's old; I'm trying to march forward.)
I'm sick of screwing around trying to script a clean solution to burn multiple files and folders to CDs and DVDs with wodim, growisofs and genisoimage.I'm looking for a high level command line program that uses sensible defaults and takes arguments something like this:[program-name] [cd|dvd] /path/to/dir1/ /path/to/dir2/ /path/to/file ...It should then do all the low level copying and ISO generation transparently and just burn the damn disk!Does anyone have any suggestions? I've looked at several programs but it seems there are too many choices to trawl through and not enough information about them online.
So, I usually write/find a test case generator for any code that I write. This type of code generally leads to some file output. To be thorough, I try and generate many different files to test my code on.
Say the command is like this:
Is there a way to automate this for many different values of the parameters and generate many different files?
I tried:
I wasn't able to use the $i in the filename, and without it the command gave me no errors, but did nothing else either. I know the Unix command line is very powerful, and I have a feeling that this should be possible, but I just don't know how to do it.
OS: CentOS 5.3 Enterprise Server Red Hat Nash Version 5.1.19.6
I need to find a command-line program to randomly change my MAC address. I know on Ubuntu there is a program called 'macchanger'. And on Windows another one called 'macshift'. I just can't find one for CentOS 5.3 Enterprise Edition.
Directory /path/to is mounted over NFS (same network). Some options of fstab that might be helpful:
Both rsize and wsize are 3kB hard,proto=tcp,timeo=600,retrans=2
Sometimes the imagemagick command fails and produces no file (/path to/photo_for_public might not emerge after command execution). Files might be from 100kB to 10MB. We usually re-run the command for files not generated. Sometimes it fails even twice, so we do it third time (hilariously funny, but even a third run can fail).
Are there any thoughts what may be wrong with my photo-processing setup?
I sometimes get confused by the varying command line options I need to run common Unix archiving and compression software (e.g. gzip, bzip2, zip, tar).
Is there a program out there that can just Do What I Mean for common cases? For example:
I have just installed pdfocr. Unfortunately it does not have a gui and so in time I will forget how to use it or not remember I have it.
Is there a simple generic program that will browse to where the file is and then run the command line? I suspect python will do it. Could someone point me to a suitable tutorial for this purpose.code...
I am going to do a web based search for several thousand webpages which may or may not exist. I just want a list of the addresses which work. I dont want to load into firefox, and I'd preffer not to ping the url. I just want to test the URLs for validity and kick back a list of good URLs. Any Ideas on a simple program to do this, which I can use in a bash script?
I tried to install Vlc using the terminal (terminal as root). I've used the command aptitude install vlc. Instead of installing only vlc, my gnome desktop environment was removed, gdm was removed, many more programs was removed! What's the command for installing just a single program using the command line? I was used under Ubuntu to use the command sudo apt-get install [***]
I have reinstalled Suse 10.1 as dual-boot with Windows XP. I am now unable to get a program to run from the Linux command line. I am familiar with the program and have had it running previously when the machine was Linux-only. Everything else, e.g.Firefox and Office, work fine in Suse.
[Code]...
The problem occurs with all commands - not just this one. isis3Startup.sh is in green on the screen so I assume I should be able to run it - I have never had any problem when it was installed previously.
ipcalc isn't the one I am thinking of. I remember another one that was a bit better, with more options -- easier to use.I remember that if you gave it a CIDR network /23 and an IP, it would list all of the address ranges, network, broadcast for that network..
I am wanting to write a program that runs a program or command-line. Is there are way of making a program that activates a command-line (for example executing 'ps -a -f' or '/home/shared/fah').
In addition to that, I want the program to do a 'ps -a -f' and put the results in a buff, how could I do this.
Is there an easy to use program that I can use to send mail from the command line? I want to be able to create a batch script to send mail from different text files. What I'm looking for is something like: mailapp mailserveraddress destinationmailaddress mymailaddress filetosend
Example: In rc2.d I have S99test. In it: Code: #!/bin/sh mplayer -playlist "/music/Thom Yorke - The Eraser" Reboot; hear the loveliness; press pause (lirc setup)...still loveliness.
Login as root; "pkill mplay";hear nothing; "/etc/rc2.d/S99test"; more loveliness; press pause...silence! I know that i the former case, mplayer is assigned (for lack of a proper term) to a session, e.g. tty1. Not so in the latter. But why should a program like mplayer not receive (or ignore?) input from lircd, simply because it doesn't have a session? And how can I get mplayer (or any program run from boot scripts) to work with other programs (like lircd)?
I thought about this a while ago when reading through a Python tutorial and I googled some and couldn't find an answer. Now I want to know it for Ruby, also, and it's more important now because I want to invoke Ruby with -w.
How can you use:
Code:
with a -w option to ruby, like:
Code:
This doesn't work and I can't find an explanation of how to do it.
I use a few command line programs quite often such as nano and mpc. I'd like to create a shortcut icon to open them rather than opening a terminal and then typing in the program name to open it. For example, how could i open konsole with nano opened in one step?
Is there a program I can install and run from the Command Line that will hibernate the computer (pausing all running programs (like my Minecraft server)), cutting power usage TO A BARE MINIMUM, and the un-hibernate after a set time? The laptop this will be used on is SliTaz linux with the GUI disabled (unless i run startx)