Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
Google is not my friend tonight, I keep returning a bunch of irrelevant junk no matter how I format the query.
I think what I'm trying to do is fairly simple, or at least the idea is: When firefox closes I want to run a shell command.
I'm looking for the easiest way to do this. An addon would be fine. But I can't find one.
My scripting skills are rudimentary. I now how to set up things to run shell commands on system or program start. But no idea how to execute a function on program close.
a wrapper script is just a normal shell script where you invoke the original command and also you will be able to prepare things before and do anything after.
So that wrapper script will start firefox and do something if firefox closed. And you need to start your wrapper script instead of firefox.
a wrapper script is just a normal shell script where you invoke the original command and also you will be able to prepare things before and do anything after.
So that wrapper script will start firefox and do something if firefox closed. And you need to start your wrapper script instead of firefox.
Thankx for the clarification. I chewed on it while working on some other stuff and came to pretty much that conclusion.
I'm running a hacked up version of FF dev in one of my remote machines.
They borked clean on close. It spawns an infinite restart loop due to a .js error. I did some minimum digging, decided it was over my skill level and filed a bug report.
But I still want to clean on close. So I want to run bleach bit as a user on close.
(And this post is as much to work it out before I do it as is it to make sure I have it right and understand what's going on.)
The short cut command in my start menu to run it is:
And b/c things run in a logical order and the second command can't run until after the first one is completed then the effect would be to have the clean up command run on FF close.
would be enough (I do not know this bleachbit, so I'm not really sure about that)
B/c I'm paranoid and I want to see it run instead of having to dig through logs to make sure it ran and my way spawns a terminal and lets me watch it run.
I just tested it.
It works.
Now I just need to add whatever parameter is needed to get the terminal to close after the command runs. (Googling)
I don't see any variables in there to pass a close command to it.
I've tried dozens of variations, too many to list here.
But I've tried appending exit to the end of the script itself and to the end of the last argument. I've tried spawning the terminal with nohup and disowning it. I've tried directly passing an argument to bash to close the xfce4-terminal. And on and on and on. None of it works.
But, that's only good for one shot b/c the pid changes on ever spawn. (Tested)
So how do I call pidof xfce4-terminal as a variable which I can then kill?
In your script you can put the pid of a currently running xfce4-terminal and then kill it. It should work as long as it's the only xfce4-terminal you're running at that time.
In your script you can put the pid of a currently running xfce4-terminal and then kill it. It should work as long as it's the only xfce4-terminal you're running at that time.
Yeah, it's the only xfce4-terminal running but that didn't work either.
And your solution is not all that different from ones I've tried by throwing spaghetti at the wall based on stuff I've found on the web.
This is starting to tick me off b/c it doesn't make any sense. (Not you guys. I appreciate the help. But things are not working the way I understand they should be based on my reading and advice from those more experienced than myself.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.