Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
New to the site so I hope this is the right forum...wasn't sure if I should ask this in the programming one or not?
I'm working in Solaris 9/CDE. I wrote a simple bash script that kicks off a virus scan in an xterm window and echos out some stuff....but wanted to add a couple things and for life of can't find any info on the following
A. Is there a way to make that particular window un-closeable until script is finished?
B. Is there a way kick off another script/command on the close action if the user closes the current window?
C. is there a way to restore the xterm or bring it to front after the scan is complete?
Any help would be greatly appreciated....thanks in advance!
New to the site so I hope this is the right forum...wasn't sure if I should ask this in the programming one or not?
I'm working in Solaris 9/CDE. I wrote a simple bash script that kicks off a virus scan in an xterm window and echos out some stuff....but wanted to add a couple things and for life of can't find any info on the following
A. Is there a way to make that particular window un-closeable until script is finished?
B. Is there a way kick off another script/command on the close action if the user closes the current window?
C. is there a way to restore the xterm or bring it to front after the scan is complete?
Any help would be greatly appreciated....thanks in advance!
A. xterm -hold ... -e "/path/to/yourscript.sh" & ... are other options, which must precede -e
B. the xterm referenced by A., or any window the user happens to be currently viewing?
C. fg 'its job number', see man jobs
Job number is number in square brackets, PID is other number listed by bash when background process created, e.g.
A. xterm -hold ... -e "/path/to/yourscript.sh" & ... are other options, which must precede -e
B. the xterm referenced by A., or any window the user happens to be currently viewing?
C. fg 'its job number', see man jobs
Job number is number in square brackets, PID is other number listed by bash when background process created, e.g.
Code:
~/Documents $ xterm -hold -name qwerty &
[1] 1590
Really appreciate it...I'll check out those suggestions!
I guess to answer your question B. (sorry if this makes no sense)....B. would be an alternative to A....
Say for instance....I fire off the scan and echo some stuff to the xterm and a user closes the window for whatever reason....On that close action, I'd like to kick off another script that would continue to monitor scan and what not....
Does that even remotely make any sense?
Shoot...I'm probably taking away the point of creating simple bash scripts and should probably just buck up and learn tcl/tk!
Really appreciate it...I'll check out those suggestions!
I guess to answer your question B. (sorry if this makes no sense)....B. would be an alternative to A....
Say for instance....I fire off the scan and echo some stuff to the xterm and a user closes the window for whatever reason....On that close action, I'd like to kick off another script that would continue to monitor scan and what not....
Does that even remotely make any sense?
I may have been misunderstanding you. I think what you want to do is manipulate windows through the X system. Check out in particular xdotool, also xwininfo, xsel and wmctrl
xdotool gives you as much control over X windows as a scripting system like AHK does over microsoft windows guis, but its usage is obscure.
wmctrl is more limited, but its use is straightforward
xsel lets you pass things between apps via the various clipboards
xwininfo provides info about particular windows to help identify them to xdotool. There is another app, wininfo, which provides very similar, but somewhat different info to xwininfo
That should keep you busy for a while ;-)
wmctrl will probably do everything you've mentioned here, it can test that a window exists, activate and deactivate, shut them down etc. Its easy to use because it will do these things by window name, but you do have to ensure that any names are unique.
I may have been misunderstanding you. I think what you want to do is manipulate windows through the X system. Check out in particular xdotool, also xwininfo, xsel and wmctrl
xdotool gives you as much control over X windows as a scripting system like AHK does over microsoft windows guis, but its usage is obscure.
wmctrl is more limited, but its use is straightforward
xsel lets you pass things between apps via the various clipboards
xwininfo provides info about particular windows to help identify them to xdotool. There is another app, wininfo, which provides very similar, but somewhat different info to xwininfo
That should keep you busy for a while ;-)
Ha, yeah that should keep me busy for a while! I've stumble across xdotool in some recent google'n but haven't checked it out....My main problem is it's a classified system so I'm trying to work with what I got so all the IA jerks won't get on my back about installing new software.
Thanks again for the help! Couple different directions I can go so hopefully I slap something real trivial together out of all this..
I think you should read about the NOHUP signal. Use nohup at starting of the command in your xterm, so command can keep going on until it gets finished, even after you accidently close the xterm.
See here: http://en.wikipedia.org/wiki/Nohup
Second, a closed xterm cannot be recovered or re-opened. The commands or operations that were running in it may get aborted or become defunct. Thus it's better to run important commands with nohup in xterm, so that can still generate output if xterm closes.
I think you should read about the NOHUP signal. Use nohup at starting of the command in your xterm, so command can keep going on until it gets finished, even after you accidently close the xterm.
See here: http://en.wikipedia.org/wiki/Nohup
Second, a closed xterm cannot be recovered or re-opened. The commands or operations that were running in it may get aborted or become defunct. Thus it's better to run important commands with nohup in xterm, so that can still generate output if xterm closes.
Appreciate the feedback...I'll keep that in mind on my next adventure. The current script actually stays alive even if the window is closed which I haven't exactly wrapped my head around yet. I need to look at the way it is called from the CDE button perhaps.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.