I want to write a pearl script that would be called automatically by the crown and would call the console when called. How from a pearl of a script to cause the console?

Zy Perl and Unix systems began to learn recently and I know so far badly. Do not judge strictly, if something is wrong.

  • $ DISPLAY set correctly? Is xserver connection allowed? - arto pm
  • I honestly can not answer your questions, because I do not know. Could you tell me how to check what you asked? - alnasfire
  • Where do you want to run the console? On the x-server? open a virtual terminal on the console? What is the task at all? - arto
  • I would like to get the same result as the result of the manual launch of the script (I cited the code below in the comments), i.e. see the window, or as an option, call the terminal from the code (but it seems like it will not be possible to do it through cron). - alnasfire
  • @alnasfire, I made a shell script in the comments below. Try it through cron run (only better is the absolute path to the file with a pearl spell). - avp

1 answer 1

It’s impossible to call the console from cron - you simply don’t have a controlling terminal where to redirect the I / O. But you can call any of the commands or a script without any problems using system() - see for example .

  • Is it possible to call a script from the crown that creates and displays a window with a button? - alnasfire
  • @alnasfire, you can almost everything. For a more substantive conversation, describe in detail what exactly you want to do. - Here the script is launched on crown (say at midnight) (by the way, on which server, what kind of local equipment does it have?). Where do you want to see the window? - avp
  • on my local machine, I want to run a script on crown, which would simply display a window with a button on the screen. - alnasfire
  • I do not know the standard window with the button, but I think there is a library (like tcl / tk) for drawing GUI. So write. If you allow all users to work with the local X-server (as far as I remember, you need to watch xauth), then you will have a window with a button. You first try to call nohup xterm from a script. If there are enough rights, then a window (but without buttons) will appear, and the script will wait for it to close. - avp
  • I found this script:. #! / usr / bin / perl use Gtk2 '-init'; $ window = Gtk2 :: Window-> new ('toplevel'); $ window-> set_title ("Hello world !!!!!"); $ window-> set_size_request (250,250); $ button = Gtk2 :: Button-> new ("Hello world !!!!!"); $ button-> signal_connect (clicked => sub {$ window-> destroy ()}); $ window-> add ($ button); $ window-> show_all; Gtk2-> main; 0; . if you call it from the console, a window will appear and there will be a button in it in the full window size. But when calling with crown, the script does not display a window. - alnasfire