How to run a command when any process starts?











up vote
0
down vote

favorite












I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script runs whenever any process starts or stops. Is this possible?



Edit 1: Could also just make it check the number of processes running under my user name



Edit 2: Might have to add an exception for pscircle itself










share|improve this question
























  • While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
    – Eugen Rieck
    Dec 1 at 20:13










  • Ah yea I didn't realize that. Might have to create an exception of some sort
    – The Forgotten King
    Dec 1 at 20:14






  • 2




    And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
    – Eugen Rieck
    Dec 1 at 20:16










  • What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
    – Eugen Rieck
    Dec 1 at 20:17










  • @EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
    – Fanatique
    Dec 1 at 21:18















up vote
0
down vote

favorite












I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script runs whenever any process starts or stops. Is this possible?



Edit 1: Could also just make it check the number of processes running under my user name



Edit 2: Might have to add an exception for pscircle itself










share|improve this question
























  • While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
    – Eugen Rieck
    Dec 1 at 20:13










  • Ah yea I didn't realize that. Might have to create an exception of some sort
    – The Forgotten King
    Dec 1 at 20:14






  • 2




    And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
    – Eugen Rieck
    Dec 1 at 20:16










  • What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
    – Eugen Rieck
    Dec 1 at 20:17










  • @EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
    – Fanatique
    Dec 1 at 21:18













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script runs whenever any process starts or stops. Is this possible?



Edit 1: Could also just make it check the number of processes running under my user name



Edit 2: Might have to add an exception for pscircle itself










share|improve this question















I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script runs whenever any process starts or stops. Is this possible?



Edit 1: Could also just make it check the number of processes running under my user name



Edit 2: Might have to add an exception for pscircle itself







linux bash script sh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 1 at 20:14

























asked Dec 1 at 20:10









The Forgotten King

11




11












  • While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
    – Eugen Rieck
    Dec 1 at 20:13










  • Ah yea I didn't realize that. Might have to create an exception of some sort
    – The Forgotten King
    Dec 1 at 20:14






  • 2




    And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
    – Eugen Rieck
    Dec 1 at 20:16










  • What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
    – Eugen Rieck
    Dec 1 at 20:17










  • @EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
    – Fanatique
    Dec 1 at 21:18


















  • While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
    – Eugen Rieck
    Dec 1 at 20:13










  • Ah yea I didn't realize that. Might have to create an exception of some sort
    – The Forgotten King
    Dec 1 at 20:14






  • 2




    And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
    – Eugen Rieck
    Dec 1 at 20:16










  • What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
    – Eugen Rieck
    Dec 1 at 20:17










  • @EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
    – Fanatique
    Dec 1 at 21:18
















While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
– Eugen Rieck
Dec 1 at 20:13




While it might be possible, it would also be a big mistake: When the pscircle process starts it would create another trigger, which would start pscircle ...
– Eugen Rieck
Dec 1 at 20:13












Ah yea I didn't realize that. Might have to create an exception of some sort
– The Forgotten King
Dec 1 at 20:14




Ah yea I didn't realize that. Might have to create an exception of some sort
– The Forgotten King
Dec 1 at 20:14




2




2




And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
– Eugen Rieck
Dec 1 at 20:16




And of course you start pscircle with a bash script, so there is another exception, and the wallpaper change starts a dbus session, creating another process, plus what cron and friends do ... you'd end up with your system being quite busy just changing wallpapers.
– Eugen Rieck
Dec 1 at 20:16












What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
– Eugen Rieck
Dec 1 at 20:17




What stops you from using a load indicator applet and do the pscircle magic only every few seconds?
– Eugen Rieck
Dec 1 at 20:17












@EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
– Fanatique
Dec 1 at 21:18




@EugenRieck is completely right here. In just a second over 100 processes can start and stop in that same second (processes like forking web servers). Changing your wallpaper that frequently will just crash your system.
– Fanatique
Dec 1 at 21:18















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380036%2fhow-to-run-a-command-when-any-process-starts%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380036%2fhow-to-run-a-command-when-any-process-starts%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!