2

I am writing a sh file to take screen short and want to schedule in crontab but when i run the .sh file it run OK no problem happens but when try to schedule it in crontab i got an error like

import: unable to open X server `' @ error/import.c/ImportImageCommand/366.

my .sh file is like

#!/bin/bash
filename='ABC'
import -window root $HOME/Desktop/$filename.png

any idea how to solve it i tried with

which import

it is showing

/usr/bin/

2 Answers 2

6

You could probably add this line before the import line

export DISPLAY=':0'
1
  • You can what existing 'displays' you are running on using w.
    – Wilf
    Feb 18, 2014 at 11:32
2

There is also a small software that can be useful for this task, allowing you some extra options, like delay between the screenshot and your command. It is called scrot.

I understand this is not your point here, but still can be a useful information for someone that google to here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .