LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-25-2012, 09:37 AM   #1
JimiSc
LQ Newbie
 
Registered: Jun 2012
Location: New Mexico
Distribution: openSuse 12.1
Posts: 18

Rep: Reputation: 11
Cool Trying to kill a Firefox window through remote ssh session


Hello,

I am lost as to what command I can use to kill a Firefox window through a remote ssh session. I have a Linux machine running openSuse 12.1 that I use here at work for our lobby t.v. I have crontab set to open Firefox first thing in the morning and when it does that Firefox, due to the web address that it is pointed too, opens a total of three windows, only two of which i actually need displayed. So my question is what terminal command can I use to kill the one window I do not need? I would like to be able to eventually add the command to the .sh script I wrote to open Firefox.

Thanks in advance for the help

Jimi
 
Old 06-25-2012, 10:41 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by JimiSc View Post
Firefox, due to the web address that it is pointed too, opens a total of three windows
So what's wrong with the address? Does it use something like "target="blank"" to open several windows?
 
Old 06-25-2012, 11:31 AM   #3
JimiSc
LQ Newbie
 
Registered: Jun 2012
Location: New Mexico
Distribution: openSuse 12.1
Posts: 18

Original Poster
Rep: Reputation: 11
unSpawn,

No it does not return anything like that. After reading my post I realized I did not explain that very clearly. Firefox's home page is set to an internal web address http://xxx.xxxxx.xxx/xxx/luanch.php (sorry for security reasons cant give the whole address), from there it opens two additional windows that have the actual info that I want displayed, conference schedules, contact info and so on. The original window just stays a blank grey screen that to be honest is doing nothing and for cleanliness I would like to be able to close it and just have the two windows open that are needed. I remote into this box using PuTTY so I would like to be able to do this through the terminal.
 
Old 06-25-2012, 12:10 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I think the way is to identify the window (by title) and send a close command. You can try wmctrl to implement it.

Last edited by pan64; 06-26-2012 at 01:07 AM. Reason: mistyped
 
2 members found this post helpful.
Old 06-25-2012, 12:49 PM   #5
JimiSc
LQ Newbie
 
Registered: Jun 2012
Location: New Mexico
Distribution: openSuse 12.1
Posts: 18

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by pan64 View Post
I think the way is to identify the window (by title) and send a close command. You can try wmctrl so implement it.
I have installed this program and when I try to use it all I get is 'Cannot open display' I have tried using wmctrl -F -c <window name> as well as /usr/bin/wmctrl -F -c <window name>, both give me the same message Cannot open display.
 
Old 06-25-2012, 12:54 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
that means you do not have access right to that DISPLAY. In this case there is no way to identify the window, there is no way to send events to that window manager, you can only kill the process (firefox) itself. You need to give access right to that user...
 
Old 06-25-2012, 01:02 PM   #7
JimiSc
LQ Newbie
 
Registered: Jun 2012
Location: New Mexico
Distribution: openSuse 12.1
Posts: 18

Original Poster
Rep: Reputation: 11
I see.....that would make sense. Ok so then how would I go about giving access to it through an ssh session? Still pretty new to Linux.
 
Old 06-25-2012, 01:59 PM   #8
JimiSc
LQ Newbie
 
Registered: Jun 2012
Location: New Mexico
Distribution: openSuse 12.1
Posts: 18

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by pan64 View Post
I think the way is to identify the window (by title) and send a close command. You can try wmctrl so implement it.
Thank you for letting me know about this command. I was finally able to get it to work and close out the window I wanted it to close. I forgot that since I was running this command remotely that I had to first tell it what display it was, Adding DISPLAY=:0 to the beginning of the command made it work with no further issues. Thanks again
 
Old 06-26-2012, 01:12 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
Quote:
Originally Posted by JimiSc View Post
Ok so then how would I go about giving access to it through an ssh session? Still pretty new to Linux.
This is not possible in general. You cannot give yourself access rights to another display, the owner of that display can give you access with the command xhost. In your case the user was the same and therefore you did not need to set additional rights but the DISPLAY variable. ssh does not know about that session.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
konsole window title change in SSH session maenho Linux - Software 4 08-31-2010 02:32 PM
Fedora 11 rejecting remote telnet session from Window XP AmirArif Linux - Software 2 09-21-2009 02:00 PM
How to kill remote processes started with SSH? gjb1002 Linux - General 15 08-26-2009 03:35 PM
How to logoff the remote ssh session of a user after a certain idle time. ashishshukla Linux - Server 3 10-07-2008 08:57 AM
View remote SSH session nikko Slackware 2 06-17-2004 01:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration