Firejailed programs check script
Hello.
I'm using firejail to run some apps like Chromium for example. What I want to do now is to write a script that in a specific interval of time will check for example if all chromium processes are running through firejail. If this is not the case then it will inform me with a notify-send command. So I'm wondering how can I achieve something like this and any idea will be thankful. |
Quote:
If you want your script to run at certain times, I would personally use either cron or an eternal loop with a sleep statement in the script, cron would be my first choice. Using notify-send in a script is no problem as long as you don't run the script as root. The latter can be done (I actually do that in one of my scripts on my Arch box) but it requires a bit of extra work. As a normal user, you just: Code:
notify-send "Hello" Best regards, HMW |
Thank you very much for your answer but i was wondering on the part of the script that will check if the chromium's process runs through firejail.
For example i tried to implement that part of the script by checking if the parent pid of the chromium belongs to firejail process but for some reason that didn't work. |
Quote:
|
Finally i fixed the problem with the script and now it can print out if the chromium is firejailed or not.
Here is the code : Code:
#!/bin/bash Any idea? |
Great!
Just a hint, instead of doing Code:
pid=$(ps -A | grep -m1 chromium | awk '{ print $1 }') Code:
pid=$(pidof chromium) Also, there is a slight error in your 2nd notify, you wrote "critival" instead or critical, so it might not work as expected. As far as only running this when chromium starts you could use cron, I would! Good work! HMW |
Thank you very much for your notices
I also make some changes to the script and now ps returns a sorted list of chromium processes because i had a little problem with the previous version. Here is the update : Code:
#!/bin/bash |
All times are GMT -5. The time now is 01:11 AM. |